IEditableCollectionView.CancelEdit Metoda

Definice

Ukončí transakci úprav a pokud je to možné, obnoví původní hodnotu položky.

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

Příklady

Následující příklad získá CanCancelEdit ke kontrole, zda původní hodnoty upravené položky lze obnovit před voláním CancelEdit. Pokud hodnoty nelze obnovit, musíte k tomu zadat další logiku. Pokud je to možné, hodnoty se obnoví, když příklad zavolá CancelEdit. Celou ukázku najdete v tématu Změna kolekce pomocí ukázky 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()

Poznámky

CancelEdit nastaví CurrentEditItem na null a způsobí, že zobrazení kolekce ukončí stav úprav. Pokud CanCancelEdit je true, CancelEdit obnoví také původní hodnoty upraveného objektu.

Platí pro