When you use Visual Studio 2010, you will find there is no a WPF chart control in toolbox. The WPF chart control does not followed with .NET 4.0 release, It is still in .NET 3.5 WPFtoolkit.  You might have to download the WPF toolkit and install it. But please check before you download and install, [Read More ...]

Actually, there is no big different if you want to programmatically click a button in either WPF or Windows Form. They might have slightly different approach. Click: Button1.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); Press: typeof(Button).GetMethod("set_IsPressed", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(Button1, new object[] { true }); Unpress: typeof(Button).GetMethod("set_IsPressed", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(Button1, new object[] { false }); Other solution is just ButtonAutomationPeer: Please [Read More ...]

You can use either of code behind or XAML to implement data binding in WPF: 1: Code behind binding: There are MultiBinding and Binding (single) 2 types: //binding background color MultiBinding multiBinding = new MultiBinding(); multiBinding.Converter = new ViewModels.DeviceIOViewModel.TypeAndStatusToColorConverter(); multiBinding.Bindings.Add(new Binding { Source = DeviceIODataList.DeviceList[this.DeviceIndex], //this.IODataSource, Path = new PropertyPath("DeviceType") }); multiBinding.Bindings.Add(new Binding { Source [Read More ...]

In a multithread WPF project, we got program crash, but actually WPF did not give us any help or error information on the screen, then we tried to debug using steps,  finally we got the following error information on a line of code with adding related variable in this line of code into Watch window: [Read More ...]

When you try to use ConfigurationManager in your WPF project, you might can not get it work because there is no related reference by default in WPF project. You have to add the reference manually, check MSDN here, we know we have to add the reference to System.Configuration.dll file. After above step, you can add [Read More ...]

There is no mouse hover event in WPF, The MouseHover function has been split into two parts: MouseEnter and MouseLeave. So we can use them if we need mouse Hover function. private void UserControl_MouseEnter(object sender, MouseEventArgs e) { … } private void UserControl_MouseLeave(object sender, MouseEventArgs e) { … }

This is a learning notes. We are not going to tell more knowledge about WPF multiple threads, we just give some samples which we practiced. There are different solutions to implement multiple threads in WPF: 1: The Task: We firstly introduce the task is because it is recommended in .NET 4, it is a newer [Read More ...]

1: Windows Presentation Foundation Data Binding: Part 1 2: Windows Presentation Foundation Data Binding: Part 2 3: WPF : Binding to individual collection items (but not in a ItemsControl) 4: How to: Create a Binding in Code 5: Change Shape’s location due to variable on Canvas (Chinese) 6: IValueConverter Interface 7: IValueConverter in WPF data [Read More ...]

There are 2 ways to get the automatic notice target object if the source object changed (for example: the value) when you using WPF data binding: the one is Dependency Properties, the other one is INotifyPropertyChanged: InotifyPropertyChanged  sample: public class IODataPresentation : INotifyPropertyChanged {     public event PropertyChangedEventHandler PropertyChanged;     private string _ValueString;     public [Read More ...]

Thumb control is a very helpful control which can help we drag a control. Here is a Microsoft sample : How to: Use a Thumb to Enable Dragging Here is another nice sample which using Blend : Resizing a Custom WPF Window

© 2012 CodeEase.com Suffusion theme by Sayontan Sinha