匯出 (0) 列印
全部展開

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)

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.

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.

社群新增項目

新增
Microsoft 正展開一份線上問卷調查,了解您對於 MSDN 網站的看法。 如果您選擇參加,您離開 MSDN 網站時即會顯示線上問卷調查。

您是否想要參加?
顯示:
© 2014 Microsoft