Data Binding Types


A particular data binding can be of three types: OneTime , OneWay , and TwoWay . You set the BindType property to one of those enumerated values when you declare the binding.

One-Time Data Binding

When you request one-time data binding, the runtime, using the data source and the specified path , retrieves the source value and initializes the specified target property to that value. Normally, nothing happens subsequently when the source or the target property change value.

However, there are two special cases. When the DataContext of an element changes, effectively, the data source has changed and therefore the binding performs another one-time transfer. In addition, in many cases, the data context refers to a collection of objects. When the current object for a collection changes, the data binding performs a one-time transfer.

One-Way Data Binding

When you request one-way data binding, the runtime retrieves the source value and initializes the specified target property to that value. Each time the source value changes the data binding retrieves the new value and reinitializes the target property.

Two-Way Data Binding

When you request two-way data binding, the runtime retrieves the source value and initializes the specified target property to that value. Each time the source value changes, the data binding retrieves the new value and reinitializes the target property. In addition, when the target property changes value ”for example, when the user types into an edit control ”the data binding retrieves the new target property value and propagates it back to the source. Two-way data binding is the default type of a data binding.




Introducing Microsoft WinFX
Introducing WinFX(TM) The Application Programming Interface for the Next Generation of Microsoft Windows Code Name Longhorn (Pro Developer)
ISBN: 0735620857
EAN: 2147483647
Year: 2004
Pages: 83
Authors: Brent Rector

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net