IEditableCollectionView.CancelEdit メソッド

定義

編集トランザクションを終了し、可能な場合は元の値をアイテムに復元します。

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

次の例では、CancelEditを呼び出す前に、編集済みアイテムの元の値を復元できるかどうかを確認するCanCancelEditを取得します。 値を復元できない場合は、追加のロジックを指定する必要があります。 可能な場合は、例で 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()

注釈

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

適用対象