Export (0) Print
Expand All

Binding.Mode Property

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)

'Declaration
Public Property Mode As BindingMode
<Binding Mode="bindingModeMemberName"/>

Property Value

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

ExceptionCondition
InvalidOperationException

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

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

See Binding Markup Extension to learn how Mode can be set as a binding property through the Binding markup extension, which enables specifying an entire Binding as an attribute string.

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


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


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft