Skip to main content
A newer version of this page is available. .

ColumnView.ShowingEditor Event

Occurs when a cell inplace editor is about to open, and allows you to cancel this action.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v19.2.dll

Declaration

[DXCategory("Editor")]
public event CancelEventHandler ShowingEditor

Event Data

The ShowingEditor event's data class is CancelEventArgs. The following properties provide information specific to this event:

Property Description
Cancel Gets or sets a value indicating whether the event should be canceled.

Remarks

To identify the cell whose editor is about to be invoked, use the ColumnView.FocusedRowHandle and ColumnView.FocusedColumn properties. You can then set the e.Cancel parameter to true to prevent the editor from being shown.

The code sample below illustrates how to suppress in-place editor activation for all ID column cells if they belong to even grid rows. You can test this sample in this live demo.

gridView.ShowingEditor += (s, e) => {
    e.Cancel = gridView.FocusedColumn.FieldName == "ID" && gridView.FocusedRowHandle % 2 == 0;
};

If you need to prevent users from editing any Grid cells (or any cells that belong to the individual column), do not cancel the ShowingEditor event. Instead, disable the ColumnViewOptionsBehavior.Editable or OptionsColumn.AllowEdit settings.

The ShowingEditor occurs before the editor opens. If you need to perform specific actions after the editor is shown, handle the ColumnView.ShownEditor event instead.

Note

The ShowingEditor event does not fire for Auto Filter Row cells.

Online Video

WinForms Grid: Prevent Editing in Specific Cells.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ShowingEditor event.

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