Прочетете на английски Редактиране

Споделяне чрез


BindingGroup.CancelEdit Method

Definition

Ends the edit transaction and discards the pending changes.

C#
public void CancelEdit();

Examples

The following example calls CancelEdit to discard the pending changes and then calls BeginEdit to prepare the source to be re-edited.

C#
private void Cancel_Click(object sender, RoutedEventArgs e)
{
    // Cancel the pending changes and begin a new edit transaction.
    stackPanel1.BindingGroup.CancelEdit();
    stackPanel1.BindingGroup.BeginEdit();
}

Remarks

This method causes the sources to discard the pending changes, if a source object is capable of doing so and end the edit transaction. Then the method updates the target properties with the saved source values.

For each object in Items that implements IEditableObject, CancelEdit calls IEditableObject.CancelEdit

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, 10