Editar

Partilhar via


Binding.UpdateSourceTrigger Property

Definition

Gets or sets a value that determines the timing of binding source updates.

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

Property Value

One of the UpdateSourceTrigger values. The default is Default, which returns the default UpdateSourceTrigger value of the target dependency property. However, the default value for most dependency properties is PropertyChanged, while the Text property has a default value of LostFocus.

A programmatic way to determine the default UpdateSourceTrigger value of a dependency property is to get the property metadata of the property using GetMetadata(Type) and then check the value of the DefaultUpdateSourceTrigger property.

Remarks

Bindings that are TwoWay or OneWayToSource listen for changes in the target property and propagate them back to the source. This is known as updating the source. Usually, these updates happen whenever the target property changes. This is fine for check boxes and other simple controls, but it is usually not appropriate for text fields. Updating after every keystroke can diminish performance and it denies the user the usual opportunity to backspace and fix typing errors before committing to the new value. Therefore, the default UpdateSourceTrigger value of the Text property is LostFocus and not PropertyChanged.

If you set the UpdateSourceTrigger value to Explicit, you must call the UpdateSource method or the changes will not propagate back to the source.

Applies to

See also