Skip to main content

SpreadsheetControl.CloseCellEditor(CellEditorEnterValueMode) Method

Closes the cell editor.

Namespace: DevExpress.Xpf.Spreadsheet

Assembly: DevExpress.Xpf.Spreadsheet.v24.2.dll

NuGet Package: DevExpress.Wpf.Spreadsheet

Declaration

public bool CloseCellEditor(
    CellEditorEnterValueMode mode
)

Parameters

Name Type Description
mode CellEditorEnterValueMode

A CellEditorEnterValueMode enumeration member.

Returns

Type Description
Boolean

true, if the cell editor is closed successfully; otherwise, false.

Remarks

Use the CloseCellEditor method to close the cell editor activated by an end-user to enter or edit a cell value. To check whether a cell editor is currently active, use the SpreadsheetControl.IsCellEditorActive property. The CloseCellEditor method’s parameter specifies whether a value that has been entered or edited via the cell editor should be committed or rolled back when closing the editor.

The following table lists modes in which the cell editor can be closed, gives the CloseCellEditor method’s parameter value that corresponds to each mode, a shortcut that closes the cell editor in each mode, and events that are raised in each mode.

Mode

Parameter

Shortcut

Events

Commit an entered cell value to an active cell.

CellEditorEnterValueMode.ActiveCell

ENTER

SpreadsheetControl.CellEndEdit

SpreadsheetControl.CellValueChanged

Commit an entered cell value to all cells that are currently selected.

CellEditorEnterValueMode.SelectedCells

CTRL+ENTER

SpreadsheetControl.CellEndEdit

SpreadsheetControl.CellValueChanged

Commit an entered formula to an active cell or selected cells as an array formula.

CellEditorEnterValueMode.ArrayFormula

CTRL+SHIFT+ENTER

SpreadsheetControl.CellEndEdit

SpreadsheetControl.CellValueChanged

Cancel an entry in the cell editor.

CellEditorEnterValueMode.Cancel

ESC

SpreadsheetControl.CellCancelEdit

Note that you can specify when the SpreadsheetControl.CellValueChanged event should be raised after a cell value has been edited via the cell in-place editor and committed: each time, or only if a cell value has been changed. To do this, use the SpreadsheetCellEditorBehaviorOptions.CommitMode property, accessible via the SpreadsheetControl.Options.Behavior.CellEditor.CommitMode notation.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CloseCellEditor(CellEditorEnterValueMode) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also