BindingMode Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Describes how the data propagates in a binding.
public enum class BindingMode
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
enum class BindingMode
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public enum BindingMode
Public Enum BindingMode
<object property="enumMemberName"/>
- Inheritance
-
BindingMode
- Attributes
Windows requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
Fields
Name | Value | Description |
---|---|---|
OneWay | 1 | Updates the target property when the binding is created. Changes to the source object can also propagate to the target. |
OneTime | 2 | Updates the target property when the binding is created. |
TwoWay | 3 | Updates either the target or the source object when either changes. When the binding is created, the target property is updated from the source. |
Examples
This example demonstrates how to set the binding mode in XAML.
<TextBox x:Name="MyTextBox" Text="Text" Foreground="{Binding Brush1, Mode=OneWay}"/>
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.