Redigera

Dela via


BindingGroup.SharesProposedValues Property

Definition

Gets or sets a value that indicates whether the BindingGroup reuses target values that have not been committed to the source.

public:
 property bool SharesProposedValues { bool get(); void set(bool value); };
public bool SharesProposedValues { get; set; }
member this.SharesProposedValues : bool with get, set
Public Property SharesProposedValues As Boolean

Property Value

true if the BindingGroup reuses target values that have not been committed to the source; otherwise, false. The default is false.

Remarks

A proposed value is a value that has been changed on the target of a binding, but has not been committed to the source. For example, suppose that there is a two-way binding on a TextBox and the UpdateSourceTrigger property is set to Explicit. If the user changes the value of the TextBox, the proposed value is the value that is in the TextBox before it is committed to source.

When SharesProposedValues is true, the BindingGroup uses the proposed value when one binding leaves the BindingGroup and another Binding with the same source joins the BindingGroup. For example, suppose that an application enables a user to edit multiple fields and update the source object by clicking a button. When a field is not being edited, the application displays it in a TextBlock. When the user begins to edit a field, the application replaces the TextBlock with a TextBox. When the user finishes editing that field, the application replaces the TextBox with a TextBlock. Because the source is not updated until the user clicks the button, there must be a way for the TextBlock to display the proposed value. By setting SharesProposedValues to true, the application will display the user's changes to a field even when the source has not been updated.

Applies to