IEditableCollectionView.CancelEdit メソッド

定義

編集トランザクションを終了し、可能な場合は、項目の元の値を復元します。

public:
 void CancelEdit();
public void CancelEdit ();
abstract member CancelEdit : unit -> unit
Public Sub CancelEdit ()

次の例では、 CanCancelEdit を呼び出CancelEditす前に、編集済みアイテムの元の値を復元できるかどうかをチェックします。 値を復元できない場合は、追加のロジックを指定する必要があります。 可能な場合は、例で を呼び出 CancelEditしたときに値が復元されます。 サンプル全体については、「 IEditableCollectionView サンプルを使用したコレクションの変更」を参照してください。

// If the objects in the collection can discard pending 
// changes, calling IEditableCollectionView.CancelEdit
// will revert the changes. Otherwise, you must provide
// your own logic to revert the changes in the object.

if (!editableCollectionView.CanCancelEdit)
{
    // Provide logic to revert changes.
}

editableCollectionView.CancelEdit();
' If the objects in the collection can discard pending 
' changes, calling IEditableCollectionView.CancelEdit
' will revert the changes. Otherwise, you must provide
' your own logic to revert the changes in the object.

If Not editableCollectionView.CanCancelEdit Then
    ' Provide logic to revert changes.
End If

editableCollectionView.CancelEdit()

注釈

CancelEditは にnull設定CurrentEditItemされ、コレクション ビューは編集状態を終了します。 が のtrueCancelEdit場合CanCancelEditは、編集されたオブジェクトの元の値も復元されます。

適用対象