wpf

XML data binding in WPF

I am attempting to write an app that decodes some unsigned long values. Format of each value is represented in XML as: <Project Name="Project1"> <Message Name="a"> <BitField high="31" low="28"> <value>0001</value> <value>1010</value> </Bitfield> <BitField high="27" low="17"> <value>000111101</value> </BitField> <Bit...

usercontrol default style

Hi I've created a user control like this: <UserControl.Resources> <LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0"> <GradientStop Color="#F3F3F3" Offset="0"/> <GradientStop Color="#EBEBEB" Offset="0.5"/> <GradientStop Color="#DDDDDD" Offset="0.5"/> <GradientStop Color="#CDCDCD" Offset="1"/> ...

WPF Data Validation from a property setter function

Hi There, I have a class that is bound to GUI elements as follows: <TextBox Style="{StaticResource ValidatedTextBox}" Text="{Binding MaxDistance, ValidatesOnExceptions=True}" > <TextBox.Style> <Style TargetType="TextBox" > <Style.Triggers> <Trigger Property="Validation.HasError" Value="True"> <Setter Pr...

How can we use datagrid in wpf?

How can we use datagrid in wpf? I can not see the datagrid control in framework 3.5. ...

iTextSharp to generate PDF from WPF FixedDocument

I have a simple WPF app that displays and prints some reports with a FixedDocument. How can generate PDF's from that, with a free and open solution, such as iTextSharp? ...

WPF - Assign F-keys to buttons

I know about "_" instead of "&" but how to assign F1,F2... key to a button ? It's a small application, i'm not using Commands just straight click event handlers but I could use commands if necessary ...

how to use mvvm and icommand?

i have a textbox and i want to use it to search on listbox that has datatemplate inside it a checkbox and i'm using mvvm . I want to highlight the item that matches the textbox text how can i do that? Thanks ...

Send command to templated content of tabcontrol

I've been busy with WPF for quite some time, but I keep struggling with WPF commands. One thing I keep wondering is how the following problem should be solved. I want the button outside the TabControl to send commands to the templated TextBox within the TabControl: <StackPanel> <StackPanel.Resources> <Collections:ArrayList ...

How to open a new window using MVVM Light Toolkit

Hi guys, I am using MVVM light toolkit in my wpf application. I would like to know what is the best approach for opening a new window from an existing window. I have got this MainViewModel, which is respnsible for MainWindow of my application. Now in the MainView, on a button click, I would like to open a second window on top of it. I h...

WPF Not sending MouseMove events after CaptureMouse();

I'm trying to have a WPF canvas with rounded rectangles on that I can drag round using the mouse. However once I try and capture the mouse on the canvas I don't get the move events any more. This is a "mycanvas" user control and the rectangles are "foo" user controls. The XAML for these (minus the preamble) are: mycanvas.xaml: <Canv...

Updating GUI from a different class?

Perhaps this is a very basic question, please pardon me if it is --- I'm a beginner in C#. I have a WPF GUI for sending commands to a receiver. The commands are ASCII texts. Now, I separated the communication part into a separate project because I have console applications that use the communication methods in addition to the GUI. The c...

Panel.ZIndex is not working controls placed on the two different Tab controls

Aim: When the mouse is over on a button then the button height should become double and the button should be displayed on top of other controls. Controls can be present in 'N'number of panels or tabpages in a screen. Actually Control placed on the Tab Control hides inside the Tab Control itself when it expands even though Panel.ZIndex =...

WPF: Make window unresizeable, but keep the frame?

I have a window that does not have a title bar (WindowStyle == WindowStyle.None). The entire window uses the Aero glass effect. When I make the window unresizeable (ResizeMode == ResizeMode.NoResize), the glass effect disappears and my controls just hang in midair. (Essentially, the window itself disappears but leaves its contents.) Is ...

WPF Commands - changing target control's property

I am creating a command which will have a Textbox control as target. Code to create the command: public class Commands { public static RoutedCommand Appender; static Commands() { Appender = new RoutedCommand(); } public static void AppenderExecuted(object target, ExecutedRoutedEventArgs e) { Sy...

WPF: Passing values to Validation Rules from bound data

Hi There, Quick question. I have a validator configured in WPF that checks to ensure that a value is within a specific range. This works great. See code below: <TextBox Name="valueTxt" Style="{StaticResource SquareBox}" GotKeyboardFocus="amountTxt_GotKeyboardFocus" GotMouseCapture="amountTxt_GotMouseCapture" LostFocus="boxLostFocus" Hei...

c# progressbar not updating

I have a ProgressBarWindow which has a progressbar and a cancel button on it which I use to report progress on file I/O. However, the UI Thread of the ProgressBarWindow and my main window both hang despite all the work being done in a backgroundworker. The progressbar is rendered, as is my main window, but does not update whilst the back...

CheckBox no checked Event when mouse hits content

Hi there, I have a question about CheckBox. I don't want the CheckBox to fire the checked event when the user clicks on the content of the CheckBox. I know that I can set IsHitTestVisible = False in the ContentPresenter. At the moment I can't initialize my CheckBox with cb.IsChecked. Any ideas regarding this? Or has anyone a different...

Dependency property quesion regarding design.

Hi, I have 2 custom controls that are independent of each other in a wpf application. However, I have some behavior that needs to replicated in both the controls that is similiar. For example, when a user does drag drop on either of these 2 controls, i need more or less the same behavior to execute. The same behavior also consists of ...

Silverlight update bindings

I have item template with image and textblock. And textblock binded to Name property. Everything working fine while i not trying to update my data. When i set to my source node new name in tree i see old name. How to update text inside item template? <my:TreeView.ItemTemplate> <toolkit:HierarchicalDataTemplate ItemsSource="{...

Create a WPF window from command prompt application

Is it possible to create WPF window from a command prompt application? for example I have a MainWindow WPF class with contains the main windows of my application. when I use the following code in my command prompt application I get this error: "The calling thread must be STA". class Program { static void Main(string[] args)...