Binding in WPF

18.01.2016
Binding: •Often need to update one element with information from another. Example: • Displaying information from collection of objects in List or Combo Box etc. • Or displaying data coming from database to Data Grid. Example: • Displaying list of Customer in ListBox. • Enabling and Disabling any control depending upon input of other control. • Displaying no. of character entered in Textbox in Text Block. • There are infinite no. of reasons to use binding. Binding Source: • Binding source can be any property of any object. • Binding object connects source to binding target. Binding Target: • Target is dependency property of some object. Binding Details: Standard binding markup extension includes ElementName and Path attributes: Text="{Binding ElementName = SourceControl, Path=Value}“ Path property can refer to property or property of a property. Binding modes: • OneTime • OneWay • TwoWay Binding - Value Conveters: • Value converter allows dependency property to convert into required format. Value converter are declared in markup along with binding markup. • System.Windows.Data.IValueConverter interface • Some time binding require converters.

Похожие видео

Показать еще