Binding.Mode property
Gets or sets a value that indicates the direction of the data flow in the binding.
Syntax
<Binding Mode="bindingModeMemberName"/>
XAML Values
- bindingModeMemberName
-
A named constant from the BindingMode enumeration, such as OneWay.
Property value
Type: BindingMode
One of the BindingMode values.
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 C# or Microsoft Visual Basic, implement System.ComponentModel.INotifyPropertyChanged. For Visual C++ component extensions (C++/CX), implement Windows::UI::Xaml::Data::INotifyPropertyChanged.
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
|
Minimum supported client | Windows 8 |
|---|---|
|
Minimum supported server | Windows Server 2012 |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 12/4/2012
