BindingGroup.CommitEdit メソッド
定義
すべての ValidationRule オブジェクトを実行し、すべての検証ルールが成功した場合はバインディング ソースを更新します。Runs all the ValidationRule objects and updates the binding sources if all validation rules succeed.
public:
bool CommitEdit();
public bool CommitEdit ();
member this.CommitEdit : unit -> bool
Public Function CommitEdit () As Boolean
戻り値
すべての ValidationRule が成功して値がソースにコミットされた場合は true
。それ以外の場合は false
。true
if every ValidationRule succeeds and the values are committed to the sources; otherwise, false
.
例
次の例では、 CommitEdit を呼び出して保留中の変更を保存し、を呼び出して BeginEdit ソースの再編集を準備します。The following example calls CommitEdit to save the pending changes and then calls BeginEdit to prepare the source to be re-edited.
void stackPanel1_Loaded(object sender, RoutedEventArgs e)
{
// Set the DataContext to a PurchaseItem object.
// The BindingGroup and Binding objects use this as
// the source.
stackPanel1.DataContext = new PurchaseItem();
// Begin an edit transaction that enables
// the object to accept or roll back changes.
stackPanel1.BindingGroup.BeginEdit();
}
Private Sub stackPanel1_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
' Set the DataContext to a PurchaseItem object.
' The BindingGroup and Binding objects use this as
' the source.
stackPanel1.DataContext = New PurchaseItem()
' Begin an edit transaction that enables
' the object to accept or roll back changes.
stackPanel1.BindingGroup.BeginEdit()
End Sub
注釈
すべての ValidationRule 操作が成功すると、ソースオブジェクトがその処理を実行できる場合は、このメソッドによって保留中の変更がコミットされ、編集トランザクションが終了します。If every ValidationRule succeeds, this method causes the sources to commit the pending changes and end the edit transaction, if a source object is capable of doing so.
を実装するの各オブジェクトについて Items IEditableObject 、を呼び出します。 CommitEditIEditableObject.EndEditFor each object in Items that implements IEditableObject, CommitEdit calls IEditableObject.EndEdit