Binding.Mode Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets a value that indicates the direction of the data flow in the binding.

Namespace: System.Windows.Data
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

Syntax

Public Property Mode As BindingMode
public BindingMode Mode { get; set; }
<Binding Mode="bindingModeMemberName"/>

Property Value

Type: System.Windows.Data..::.BindingMode
One of the BindingMode values. The default is BindingMode..::.OneWay.

Exceptions

Exception Condition
InvalidOperationException

The Binding has already been attached to a target element, and cannot be modified.

Remarks

In OneWay or TwoWay bindings, the source object must implement INotifyPropertyChanged in order for the target to update when the source changes.

Examples

The following example demonstrates how to set the binding mode in XAML.

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

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

Binding Class

System.Windows.Data Namespace

Other Resources

Data binding for Windows Phone 8