Latest

random

C# - WPF Data Binding Tutorial

Data Binding in WPF is a powerful tool to automate the connection between data and the view of that data. It tremendously reduces the amount of code, simplifies your application development, greatly enhances reliability, and is the foundation for MVVM that we'll be discussing later.

Related Articles
Wpf for Beginner databinding in wpf wpf data binding c# wpf data binding tutorial binding mode in wpf wpf binding path wpf datacontext
DataBinding in wpf

Binding Mode in WPF

There are following types of data binding techniques available in WPF. We will discuss one by one here :-
  • One Way BindingThe simplest form of Data Binding is One Way Binding, in which data is bound from its source (that is the object that holds the data) to its target (that is the object that displays the data).
  • Two Way BindingIn Two Way Binding, the user is able to modify the data through the user interface and have that data updated in the source. If the source changes while the user is looking at the view, you want the view to be updated.
  • INPC (INotifyPropertyChanged) : The INotifyPropertyChanged interface facilitates updating the view when the underlying data changes. It is also possible to bind, not to a standard data source, but rather to another element on the page.
  • Data Context When you are binding, you are going to be binding properties of your data source to your data target. The Data Context is the source itself and says, this is the object whose properties you're binding from.
  • List Binding :You can bind not only individual pieces of data, but collections of data and these can be bound to controls such as list boxes and combo boxes.
  • Data TemplatesWhen you do, you will need to tell the list what part of the data to display and you will do that with Data Templates.
  • Data ConversionData binding in WPF supports Data Conversion, which converts the data at the source to the type expected at the target.
  • Data ValidationAnother important aspect of data binding is ensuring that the data is valid. Many of the data binding controls support Data Validation.

In the coming articles we will learn about implementation of each WPF DataBinding mode with an Example using C# language.

I hope you will enjoy the development tips while programming with C# in WPF. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome. Also If you like this article, don't forget to share this article with your friends and colleagues.

No comments:

All Rights Reserved by Etechpulse © 2015 - 2016
Powered By Blogger

Contact Form

Name

Email *

Message *

Powered by Blogger.