IEditableCollectionView.CancelEdit Método

Definição

Termina a transação de edição e, se possível, restaura o valor original do item.

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

Exemplos

O exemplo seguinte permite CanCancelEdit verificar se os valores originais do item editado podem ser restaurados antes de chamar CancelEdit. Se os valores não puderem ser restaurados, deve fornecer lógica adicional para tal. Se possível, os valores são restaurados quando o exemplo chama CancelEdit. Para a amostra completa, veja Alterar uma Coleção Usando a Amostra 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()

Observações

CancelEdit define CurrentEditItem para null e faz com que a vista de coleção saia do estado de edição. Se CanCancelEdit for true, CancelEdit também restaura os valores originais do objeto editado.

Aplica-se a