BindingGroup.SharesProposedValues 屬性

定義

取得或設定值,這個值指出 BindingGroup 是否重複使用尚未認可至來源的目標值。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

屬性值

如果 BindingGroup 重複使用尚未認可至來源的目標值則為 true,否則為 falsetrue if the BindingGroup reuses target values that have not been committed to the source; otherwise, false. 預設為 falseThe default is false.

備註

建議的值是已在系結的目標上變更的值,但尚未認可至來源。A proposed value is a value that has been changed on the target of a binding, but has not been committed to the source. 例如,假設上TextBox有一個雙向系結UpdateSourceTrigger ,且屬性設定為ExplicitFor example, suppose that there is a two-way binding on a TextBox and the UpdateSourceTrigger property is set to Explicit. 如果使用者變更的值TextBox,建議的值就是TextBox在認可至來源之前,在中的值。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.

SharesProposedValuestrue時, BindingGroup會在一個系結離開 BindingGroup,而另一個具有相同來源的系結加入 BindingGroup 時,使用建議的值。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. 當欄位未進行編輯時,應用程式會將它顯示在TextBlock中。When a field is not being edited, the application displays it in a TextBlock. 當使用者開始編輯欄位時,應用程式會將取代TextBlock TextBox為。When the user begins to edit a field, the application replaces the TextBlock with a TextBox. 當使用者完成該欄位的編輯時,應用程式會TextBox將取代TextBlock為。When the user finishes editing that field, the application replaces the TextBox with a TextBlock. 因為在使用者按一下按鈕之前不會更新來源,所以必須有方法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. 藉由SharesProposedValuestrue設定為,應用程式將會顯示使用者對欄位所做的變更,即使來源尚未更新也一樣。By setting SharesProposedValues to true, the application will display the user's changes to a field even when the source has not been updated.

適用於