Editar

Partilhar via


Binding.Mode Property

Definition

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

public:
 property System::Windows::Data::BindingMode Mode { System::Windows::Data::BindingMode get(); void set(System::Windows::Data::BindingMode value); };
public System.Windows.Data.BindingMode Mode { get; set; }
member this.Mode : System.Windows.Data.BindingMode with get, set
Public Property Mode As BindingMode

Property Value

One of the BindingMode values. The default is Default, which returns the default binding mode value of the target dependency property. However, the default value varies for each dependency property. In general, user-editable control properties, such as those of text boxes and check boxes, default to two-way bindings, whereas most other properties default to one-way bindings.

A programmatic way to determine whether a dependency property binds one-way or two-way by default is to get the property metadata of the property using GetMetadata(Type) and then check the Boolean value of the BindsTwoWayByDefault property.

Remarks

To support OneWay and TwoWay bindings, the underlying data must implement INotifyPropertyChanged. For details, see How to: Implement Property Change Notification.

For TwoWay or OneWayToSource bindings, you can control the target-to-source updates by setting the UpdateSourceTrigger property. For more information, see UpdateSourceTrigger.

For more information on the different binding modes, see Data Binding Overview.

Applies to