共用方式為


PagedCollectionView.CancelEdit Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Ends the edit transaction and, if it is possible, restores the original value of the item.

Namespace:  System.Windows.Data
Assembly:  System.Windows.Data (in System.Windows.Data.dll)

Syntax

'Declaration
Public Sub CancelEdit
public void CancelEdit()

Implements

IEditableCollectionView.CancelEdit()

Exceptions

Exception Condition
InvalidOperationException

CanCancelEdit is false.

-or-

IsAddingNew is true.

Remarks

You start an edit transaction by calling EditItem and end it by calling CommitEdit or CancelEdit.

CancelEdit sets the CurrentEditItem to nulla null reference (Nothing in Visual Basic), discarding any pending changes, and causes the collection view to exit the edit state. PagedCollectionView only supports CancelEdit for items that implement the IEditableObject interface.

Use the CanCancelEdit property to test whether the edit can be canceled before you call CancelEdit.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.