DataGrid.CancelEdit Method

Definition

Invokes the CancelEditCommand command for the cell or row currently in edit mode.

Overloads

CancelEdit()

Invokes the CancelEditCommand command for the cell or row currently in edit mode.

CancelEdit(DataGridEditingUnit)

Invokes the CancelEditCommand command for the specified cell or row in edit mode.

CancelEdit()

Invokes the CancelEditCommand command for the cell or row currently in edit mode.

public bool CancelEdit ();

Returns

true if the current cell or row exits edit mode, or if no cells or rows are in edit mode; otherwise, false.

Remarks

If a cell is currently in edit mode, the CancelEdit method cancels the cell edit, but not any pending row edits. If a cell is not in edit mode, CancelEdit cancels all pending row edits.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

CancelEdit(DataGridEditingUnit)

Invokes the CancelEditCommand command for the specified cell or row in edit mode.

public bool CancelEdit (System.Windows.Controls.DataGridEditingUnit editingUnit);

Parameters

editingUnit
DataGridEditingUnit

One of the enumeration values that specifies whether to cancel row or cell edits.

Returns

true if the current cell or row exits edit mode; otherwise, false.

Remarks

This method reverts any pending editing changes for the specified DataGridEditingUnit and exits edit mode.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9