Hello All, I have experienced a very strange problem in my application. When I launch my WPF application, it loads fine with a window and button, upon clicking the button, it launches another form which is also fine but in this second form, when I click some button, it launches a window with a blank screen (yet I am quite sure it has got many controls to show on the screen). I have already checked `DelegateCommand`, `Events`, `Methods` but still facing the same issue. I tried deleting some files as suggested by Google in "C:\Windows\ServiceProfiles\LocalService\AppData\Local" as `~FontCache-S-1-5-21-2260904419-1400770398-4175912926-283977.dat`, `~FontCache-System.dat`, `~FontCache-FontFace.dat` but …

Member Avatar
Member Avatar
+0 forum 17

Hi, I am developing my own designer and got stuck at a point where I need to establish or implement some business logic whenever any UI Element is dragged and determine if that falls withing the boundaries of another parent control (specifically TabControl or GroupBox), so that the next time we drag the parent, the child moves with it (and of course, in case of TabControl, the child becomes part of the selected TabItem only and the other TabItems would still be shown with empty content). I also want to implement the reverse behaviour, that is, whenever a child is …

Member Avatar
Member Avatar
+0 forum 3

Windows 10 has a nice date and time display in his taskbar, it is becoming more difficult for me to see , unless I open it. Becoming older and older my eyes are not that ‘fresh’ as they used to be, so I decided to make a bigger time display that stays permanently on top of the screen. I’m not that proficient with WPF, but decided to give it a go and at last it worked! Try to do something you don’t fully understand and you will learn from.it! //Here is my code from the MainWindow.xaml file: Window x:Class="TimerWindow.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" …

Member Avatar
Member Avatar
+2 forum 2

Yes, WPF. The learning curve is steep, but what amazing things you can do with it! Look at this hexagon window for instance. Serves no purpose in a business environment I guess, but in a gaming situation it could work. For me, it was just fun to get this up and running. I’m using VS 2017. Start up a new WPF window project. Call it HexagonWindow and fill in the missing code. I still don’t understand all the intricacies of WPF, I’m just a mere mortal human being, but my quest on the subject is ongoing. Why don’t some of …

Member Avatar
Member Avatar
+0 forum 2

Hi All, Could anyone please suggest on how to apply multiple styles to multiple elements at runtime and that too the styles should be applied at the same time on all elements. For instance, I want to animate two buttons but their styles are different. Now if I apply the style to both, the style which is applied first at runtime by the compiler would be invoked and so, I will not have the blinking effect at the same time for these 2 buttons. Any suggestions please? Thanks.

Member Avatar
Member Avatar
+1 forum 5

In a XAML file you can add a control like a Button and start to edit its attributes like `<Button Width="200" ..`. When you type in Width you get something like `Width="|"` and is rather nice. After typing 200, you end up with `Width="200|"` Does anyone knows a way to let the text insertion pointer jump over the the last " Now I use the mouse for it, but it feels not good is there no keyboard shortcut for it? Google did not give me an answer.

Member Avatar
Member Avatar
+0 forum 4

Hi Everyone, I started creating a new WPF project wherein, I have just added a style to all the elements of type "Window" and "Grid" but none of these are working (rather a wierd black box is apprearing - Screenshot attached). **NOTE:** I do not want to use "x:Key" for the styles as I want these styles to be automatically applied to all the windows which I would add further. Here is the code below: ## Window XAML: ## <Window x:Class="General_WPF.Views.StartPage_View" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:General_WPF.Views" xmlns:viewModel="clr-namespace:General_WPF.ViewModels" mc:Ignorable="d" Title="Welcome User"> <Window.DataContext> <viewModel:StartPage_VM /> </Window.DataContext> <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> <Grid.RowDefinitions> <RowDefinition Height="Auto" …

Member Avatar
Member Avatar
+0 forum 7

How to zoom to the cursor position after the graphics component has been transformed? I want to be able to zoom to any of the test rectangles. The panning is done with the Middle mouse button. MouseWheel Event handles the zooming. Ignore the DrawGrid method, it's just to get some visual reference. Public Class Diagram Dim renderOrigin As New Point Dim zoom As Single = 1.0F Dim startPoint As New Point Dim isDragging As Boolean = False Dim gridSpacing As Integer = 50 Dim testRects() As Rectangle = New Rectangle() {New Rectangle(-150, -150, 70, 25), _ New Rectangle(-10, -5, 70, …

Member Avatar
Member Avatar
+0 forum 1

Hi, I am developing a WPF application in which I need to call `MouseLeftButtonDown` event in a single `DataGridTextColumn`. For that I wrote some xaml code as :- <DataGridTextColumn x:Name="myAge" Header="Age" Binding="{Binding Age, Mode=TwoWay}" IsReadOnly="True" Width="*"> <DataGridTextColumn.CellStyle> <Style TargetType="DataGridCell"> <EventSetter Event="MouseLeftButtonDown" Handler="{Binding MyAgeCommand}" /> </Style> </DataGridTextColumn.CellStyle> </DataGridTextColumn> But I am getting an "Object reference null" exception. I tried searching this over the Internet however all I found a solution in which I need to refer to an external `AttachedCommandBehavior.dll` but I don't want to do this. All I need to ask is some way so that I can bind my …

Member Avatar
Member Avatar
+0 forum 14

Hi, I have a WPF Grid with multiple controls like TextBox, ComboBox, CheckBox etc. and their properties like Text, SelectedItem, IsChecked etc. are present inside the view model bound to the view perfectly. I want to copy the values of all the controls to the Clipboard (may be) and want to paste the corresponding values of these controls again and similarly, I want to clear all the values on clear button click. I would appreciate if anyone could please suggest a possible way of achieving this functionality. Thank you very much for your help and time.

Member Avatar
Member Avatar
+0 forum 2

Forgive me, but I've only really used WinForms in the past, and MVVM and WPF are new to me. For those who use MVVM with WPF, do you actually make separate directories (namespaces) for your Models, Views and ViewModels files or is it more of an abstract idea? I fundamentally understand what the MVVM process does, I just don't completely understand how it is truely implemented. For example: If we store our data in a SQL server, in a general respect, wouldn't that dataset be the Model? It certainly represents the data and how it is all related. A "model" …

Member Avatar
Member Avatar
+0 forum 2

Hi I'm try to change the background of the matched by a Regex text. Example: input: aaa aaa aaa //double white spaces in between output: aaa aaa aaa //change the background of all matched white spaces to red But it's coloring the wrong text. I have tried and searched google for some days, but with no luck. If I can get some help i'll be very grateful .This a WPF project in VS2013. rtbClipboardContent is a RichTextBox. The code I tried: MatchCollection matches = Regex.Matches(text, RegexExpression); rtbClipboardContent.Document.Blocks.Add(new Paragraph(new Run(text))); foreach (Match m in matches) { TextPointer start = rtbClipboardContent.Document.ContentStart.GetPositionAtOffset(m.Index, LogicalDirection.Forward); …

Member Avatar
Member Avatar
+0 forum 5

After reading this excellent [code snippet](https://www.daniweb.com/software-development/csharp/code/492766/display-excel-data-in-a-datagridview) by djjeavons, and just trying to learn WPF, I decided: "Well, let's translate that to WPF!". It was a bit harder than I thought, but a great learning experience! Her's how my screen in action looks: ![WPFscreen.png](/attachments/small/1/ac05d33ccd8a190d0576fa063e54749f.png "align-left") Things that changed compared to the Forms version: --- OpenFileDialog works a bit different. --- WPF has no `DataGridView` but another beast called `DataGrid` --- Exiting an application has also changed. The communication with Excel still worked seamlessly. I managed to overcome the difficulties and learned alot in doing so. Hope you enjoy to find out …

Member Avatar
Member Avatar
+1 forum 4

Howdy So I have a set of data coming back from a process with five different pieces of data per entry in the set. Are there any fancy ways you can generate some kind of look-a-like report on the fly in WCF, else what would be the best way to go with presenting the information? Cheers Mike

Member Avatar
+0 forum 0

I am just starting a new WPF project using MVVM as a general guideline. The application will have a ribbon; when you switch between tabs, there will be different buttons that spawn dockable windows in the content pane below the ribbon. This part is done. Now, each of those windows contains a different user control. These user controls all can interact with data used in the other user controls. There is going to be somewhere between 20 - 30 different user controls. My question: Is it more efficient for me to create one single static instance of these user controls …

Member Avatar
Member Avatar
+0 forum 1

Hello Daniweb Community, I'm wanting to slice a square image into 9 pieces like below ![Image_Grid_Expected.png](/attachments/small/3/92037daf6101645e42f7718c3f4ccf65.png "align-center") the code I'm currently using is this Private Function CropBitmap(ByRef bmp As Bitmap, ByVal cropX As Integer, ByVal cropY As Integer, ByVal cropWidth As Integer, ByVal cropHeight As Integer) As Bitmap Dim rect As New Rectangle(cropX, cropY, cropWidth, cropHeight) Dim cropped As Bitmap = bmp.Clone(rect, bmp.PixelFormat) Return cropped End Function Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click PictureBox1.Image = CropBitmap(New Bitmap(PictureBox2.Image), 0, 0, 21, 21) PictureBox3.Image = CropBitmap(New Bitmap(PictureBox2.Image), 0, 21, 21, 22) PictureBox4.Image = CropBitmap(New Bitmap(PictureBox2.Image), 0, 43, 21, …

Member Avatar
Member Avatar
+0 forum 24

I have a silverlight app that uses TextBox XAML controls. In the c++ code-behind, IXRTextBoxPtr types are associated with these textboxes using "FindName" like this: FindName(L"ColNum3", &m_pColNum3); (where ColNum3 corresponds with the XAML CODE like this: ) Then, the code assigns the pointer like this: std::wstring wsTransfer; // gets the wstring from imput const WCHAR * wpszInput; wpszInput = wsTransfer.c_str(); m_pColNum3->SetText(wpszInput); but the display does not show the text data. What am I missing? What steps am I missing to have this text modification display on the screen?

Member Avatar
Member Avatar
+0 forum 2

Hi all, I have a problem i have binding validation in WPF, aplication, but now because some rules some textboxes get disambled, and the validation shows same way, is there a way to disamble the validation when they are disabled and turn on when enabled? Best Regards

Member Avatar
Member Avatar
+0 forum 1

I was just wondering, is there a way to change the colour of the squiggly line when a word is misspelled in a WPF TextBox? Here's what I mean: [Click Here](http://puu.sh/dwAdC/701c7f2c59.png) I have no idea as to where to start because I'm simply clueless. I tried editing the Textbox to see if it handles it but it seems like it doesn't. There is no property to change it.

Member Avatar
+0 forum 0

I have a multicolumn listview. There are three button Add, delete and Updata. List is working fine, it add, delete and update list data. But i want to save every row inside listview when i click save button. Bellow is my XAML. <TextBox Canvas.Left="12" Canvas.Top="12" Height="23" Name="textBox1" Width="120" TextChanged="textBox1_TextChanged" KeyDown="textBox1_KeyDown" GotFocus="textBox1_GotFocus" /> <TextBox Canvas.Left="146" Canvas.Top="12" Height="23" Name="textBox2" Width="120" TextChanged="textBox2_TextChanged" GotFocus="textBox2_GotFocus" KeyDown="textBox2_KeyDown" /> <ListView Canvas.Left="12" Canvas.Top="68" Height="183" Name="listView1" Width="253" SelectionChanged="listView1_SelectionChanged" SelectionMode="Single"> <ListView.View> <GridView> <GridViewColumn Header="Col1" Width="150" DisplayMemberBinding="{Binding Col1}"></GridViewColumn> <GridViewColumn Header="Col1" Width="50" DisplayMemberBinding="{Binding Col2}"></GridViewColumn> </GridView> </ListView.View> </ListView> <Button Name="addButton" Canvas.Left="122" Canvas.Top="41" Height="21" Width="69" Click="addButton_Click" IsDefault="True">Add</Button> <Button Name="removeButton" Canvas.Left="197" Canvas.Top="41" Height="21" Width="69" Click="removeButton_Click">Remove</Button> …

Member Avatar
+0 forum 0

I need to change the background image of a button that is declared in xaml, like this: <Button x:Name="btnBorder" Content="Moldura" Width="80" Height="80" Margin="10,6,10,6" Click="btnBorder_Click" > <Button.Background> <ImageBrush ImageSource="/Images/arrow-expand.png" AlignmentX="Center" Stretch="None" x:Name="imgSourceArrow" /> </Button.Background> </Button> and I'm trying to change the ImageSource of the ImageBrush. For that, I'm using this code in the code-behind: ImageBrush imgb = new ImageBrush(new BitmapImage(new Uri("/Resources/arrow-expand.png"))); W.btnBorder.Background = imgb; But when I run the Application, I get an error "UriFormatException was unhandled", "Invalid Uri"... How can I reference the "arrow-expand.png" image inside the resources and transform it into an Uri String to be passed into the …

Member Avatar
Member Avatar
+0 forum 1

Hello All, I am developing an application in WPF in which I need to set a generic input bindings for TAB key for every field present in the view. I somehow managed to create a common method but now I wnat to retrieve on which field the TAB key has been hit. So, I want to know how can I pass a generic framework element or anything to the command parameter so that I can retrieve on which field the vent is taking place. My xaml code is as follows :- <Window.InputBindings> <KeyBinding Key="Tab" Command="{Binding TabCommand}" CommandParameter="{Binding .}" /> </Window.InputBindings> …

Member Avatar
Member Avatar
+0 forum 1

I may be very wrong, but in the web world, just installing Bootstrap gives you some basic control over how you controls look. Is there something similar for WPF? I don't seem to find anything, I have a very basic little wpf application with a pageframe, buttons, textblocks and textboxes. But it looks very much like something I would have been writing in Winforms. :) I was hoping to install some kind of XAML library and voilà, my application would look like something made in the third millenium. Was I being a bit naive, and will I have to create …

Member Avatar
Member Avatar
+0 forum 2

I am making a erp using WPF-C# and i have a confustion on how can i connect my app to sql server after compiling. I am asking this because my app connects to DB when i compile it with Visual Studio and SQL server is already installed on my pc, So my erp app works fine on my pc but the issue is that when i run the app on another computer, App runs but DB connection failed. I installed SQL server to another computer but not working. So i make a form which ask DB connection parameters at the …

Member Avatar
Member Avatar
+0 forum 6

I've made a rectangle with another 3D point inside. The rectangle is textured with an image. Now, I need to move the point that is inside the rectangle to another 3D position. Does anyone knows how this is possible? The only way I found, that is no good for what I need to achieve was to create another function similar to the one I post here, clear the viewport and redefine the point. This doesn't work in my case because I want the texture to follow the point that was already defined when the texture was set, meaning that the …

Member Avatar
+0 forum 0

Hi, I want to use the microsoft office theme (rubban for example,the word button's form) in my C# wpf application,is it possible? I work with visual studio 2010 thanks for help

Member Avatar
+0 forum 0

![63e834471f9c1463ee1caed517a7fbf1](/attachments/small/1/63e834471f9c1463ee1caed517a7fbf1.jpg "align-right") I'm working on an a windows phone project where I need to support fully transparent backgrounds in my controls to overlay ontop of dynamic image. I want to use this "new item" path I created to show how many updates an item has. I attached an image showing the effect I'm trying to create. The number needs to be dynamic. I've trying combinding geometries, but I'm having trouble figuring out how to even get started converting both my xaml defined path and text into geometries, and then combinding them with a xor to create the exclusion. It seems …

Member Avatar
Member Avatar
+0 forum 1

Hello All, I have one webbrowser control and I took a dependency source property from the Internet and binded the same to my string Url. I took this dependency property because .Net doesn't lets you bind the Source property to a string datatype and only Uri datatype. Now I am getting the first page as google.com (set as static for now), but as I change something in the Url textbox, I want to know why this property doesn't updates in the dependency property class also. My code is as follows :- **Dependency Property Class :-** using System; using System.Collections.Generic; using …

Member Avatar
Member Avatar
+0 forum 5

Hi All, I am facing some issues when writing a xaml and my code goes as follows :- <Grid> <Grid.Resources> <!-- Shared Storyboard across the system --> <!-- This storyboard will make the image (button) grow to double its size in 0.2 seconds --> <Storyboard x:Key="expandStoryboard"> <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="2.5" Duration="0:0:0.2" /> <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="2.5" Duration="0:0:0.2" /> <Int32Animation Storyboard.TargetName="myImage" Duration="00:00:0.2" Storyboard.TargetProperty="(Panel.ZIndex)" From="998" To="999"/> </Storyboard> <!-- This storyboard will make the image revert to its original size --> <Storyboard x:Key="shrinkStoryboard"> <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="0:0:0.2" /> <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="0:0:0.2" /> </Storyboard> </Grid.Resources> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition …

Member Avatar
+0 forum 0

Hello All, I want to design a DataGrid similar to the one in the design picture attached with this article (Please see the pic attached). I want the following bindings and features :- 1. The first column of every Item (Item1,...Item5) for (LineNo=1....LineNo=?) will get bind to "Unit" which is not a collection type or array but its just and a String type property. Similarly, the other columns also are not of collection type but just one property that are **Unit (String), Status (String), UnitType (String) and Runtime (Integer)**. 2. The object, "MyObj" from which I am getting these property …

Member Avatar
Member Avatar
+0 forum 5

The End.