IEditableCollectionView.CancelEdit Método

Definição

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

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

Exemplos

O exemplo a seguir pode CanCancelEdit verificar se os valores originais do item editado podem ser restaurados antes de chamar CancelEdit. Se os valores não puderem ser restaurados, você deverá fornecer lógica adicional para fazer isso. Se puderem ser, os valores serão restaurados quando o exemplo chamar CancelEdit. Para o exemplo inteiro, consulte Como alterar uma coleção usando o exemplo 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()

Comentários

CancelEdit null define CurrentEditItem e faz com que o modo de exibição de coleção saia do estado de edição. Se CanCancelEdit estiver true, CancelEdit também restaurará os valores originais do objeto editado.

Aplica-se a