BindingGroup.CommitEdit Method

Definition

Runs all the ValidationRule objects and updates the binding sources if all validation rules succeed.

public bool CommitEdit ();

Returns

true if every ValidationRule succeeds and the values are committed to the sources; otherwise, false.

Examples

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();
}

Remarks

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.

For each object in Items that implements IEditableObject, CommitEdit calls IEditableObject.EndEdit

Applies to

제품 버전
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9