BindingMode enumeration
Collapse the table of content
Expand the table of content

BindingMode enumeration

Describes how the data propagates in a binding.

Syntax


public enum BindingMode


<object property="enumMemberName"/>

Members

The BindingMode enumeration has these members.

MemberValueDescription
OneWay1

Updates the target property when the binding is created. Changes to the source object can also propagate to the target.

OneTime2

Updates the target property when the binding is created.

TwoWay3

Updates either the target or the source object when either changes. When the binding is created, the target property is updated from the source.

Remarks

For OneWay and TwoWay bindings, dynamic changes to the source don't automatically propagate to the target. You must implement the INotifyPropertyChanged interface on the source object for this to happen.

For TwoWay bindings, changes to the target automatically propagate to the source, except if the binding target is the Text property. In that case, the update happens only when the TextBox loses focus.

For OneTime and OneWay bindings, calls to DependencyObject.SetValue automatically change the target value and delete the binding.

Examples

This example demonstrates how to set the binding mode in XAML.


<TextBox x:Name="MyTextBox" Text="Text" Foreground="{Binding Brush1, Mode=OneWay}"/>


Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Xaml.Data
Windows::UI::Xaml::Data [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Data
Windows::UI::Xaml::Data [C++]

Metadata

Windows.winmd

Attributes

[Version(0x06020000)]
[WebHostHidden()]

See also

Binding
Binding.Mode
XAML data binding sample
Data binding in depth

 

 

Show:
© 2016 Microsoft