If you use LINQ, and consider Transaction, you might choose either explicit transaction or no. Because, due to MSDN, LINQ to SQL supports 3 distinct transaction models: 1: Explicit Local Transaction 2: Explicit Distributable Transaction 3: Implicit Transaction. About Implicit transaction, because when you call SubmitChanges, LINQ to SQL will automatically starts a local transaction [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 ...]
About Big endian and Little endian explanation, please read the following content from Microsoft: When designing computers, there are two different architectures for handling memory storage. They are called Big Endian and Little Endian and refer to the order in which the bytes are stored in memory. Windows NT was designed around Little Endian architecture [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 ...]