Clean the text of the WPF GUI

I'm using WPF. I have a simple GUI with 2 text boxes, 2 radio buttons. I want set the GUI components to default (textboxs with empty text and radio buttons unchecked). How can i do it? Thanks. Explain: I receive every 1 seconds tcp message. If the he

WPF getter called several times

I have simple wpf window: <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <StackPanel> <TextBox AcceptsReturn="True" Text="{Binding A}" /><!-- TextBox1 --> <TextBox Accept

WPF Draw Lines in a loop only seems to draw a single line

I'm trying to draw several lines to the canvas within a for loop but only seems to be drawing one. What am I doing wrong? for (int x = 0; x < 10; x++) { Random rand = new Random(); double newTop = rand.Next(0, 50); Line top = new Line(); top.Stroke =

The custom button style does not work?

I'm trying to style a button, but it ends up not showing when I apply the custom style, only its content (the button's text) is visible. This is how I declare my style: <Color x:Key="NormalColor" A="255" R="60" G ="15

Bug in System.Windows.Control.RichTextBox

I am creating a control in WPF that shows units using a System.Windows.Control.RichTextBox. The problem is the RichTextBox control shows a plain text instead of a formatted text. I guess the RichTextBox control has a bug and I don't know how to do it

How to prevent _SelectionChanged from being triggered?

When pressing a button I select a user control and set ItemsSource to null CategoriesListBox.ItemsSource = null; As soon as this code runs, a SelectionChanged event fires private void CategoriesListBox_SelectionChanged(object sender, System.Windows.C

DoEvents vs anything else - & gt; for long operation COM

I have a WPF program where my model need to load a "Out-of-Proc" (.exe) COM component in order to achieve some validations when a user make an action on the UI. I'd like to inform the user that a long action will take place to let him know that

NULL key trap in the WPF application

I am using a barcode scanner and we were looking for a way to determine if input was from a keyboard or the scanner. The input will be used in a WPF POS application. We thought we had come up with a good method by using the scanners ability to prefix

How can I attach two combos in wpf

I have 2 combo boxes, one that contains a list of 'Items' and another that contains a list of 'Subitems'. The list of Subitems depends on the currently selected Item. I've got most of this working (by binding the ItemSource of the Subitems to a Possi

View population using only xaml

I read a lot about the listView and still cant understand... I defined the following listView with 5 column, the first is label and the rest are texboxes. I need to add 13 rows that every textbox and labels needs to be bind to something diffrent. So

Changing the style field from the .cs code

I have a style described in Grid.resources. How could I modify height and width(in my sample they are 20 and 20) of Ellipse from Thumb? Other properties are accessible from other parts of code but not this(( <Style x:Key="CustomThumbForSlider"

How to bind DataTable to DataGrid

This is my DataTable. DataTable _simpleDataTable = new ataTable(); var person = new DataColumn("Person") {DataType = typeof (Person)}; _simpleDataTable.Columns.Add(person); var student = new DataColumn("Student") {DataType = typeof (St

Automatic updating of data in WPF

<Window x:Class="Binding2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="

Converting XAML ControlTemplate to C #

I have been stumped with trying to convert the following code into pure c#. This XAML code is from Cavanaghs blog on how to make rounded corners on anything. The code works but I need to convert it to c# as i need it to be dynamic in some cases. If y

Linking with ElementName in Nested UserControls

I have the following simple code: <Window x:Class="WpfApplication3.MainWindow" x:Name="WindowInst" -> <local:UserControl1/> </Window> <UserControl x:Class="WpfApplication3.UserControl1" -> <Button C

WPF real-time .Net graph 4

I'm working on a diagnostic tool and receives data every 25 ms. I need this data to be drawn in my chart using a lineSeries. I'm using a a wpf chart with a lineSeries which I bind in xaml to an ObservebleCollection. The problem is that I need the col

Wpf Mvvm ComboBox

I am new in the Wpf world, so I created a couple of views and all of them have at least one ComboBox, as I am using the MvvM pattern, I get my self re-typing all the time the same line of codes to fill the Combo and to get the SelectedItem (creating

WPF - Dispatcher PushFrame ()

I'm trying to call Dispatcher.PushFrame() from several different thread but encounter an error: Must create DependencySource on same Thread as the DependencyObject. Here is a code snippet: _lockFrame = new DispatcherFrame(true); Dispatcher.PushFrame(

What is the best way to reuse blocks of XAML?

I've got many user controls like this: PageManageCustomers.xaml.cs: public partial class PageManageCustomers : BasePage { ... } which inherit from: PageBase.cs: public class BasePage : UserControl, INotifyPropertyChanged { ... } Since PageBase.cs has

How can a WPF StackPanel fill vertically from the bottom up?

I need to be able to fill a stackpanel with buttons but the buttons must appear at the bottom of the stackpanel first and populate upwards. The buttons are created dynamically and there's an unknown number of them so visual hackery just won't work. I