windowsforms-devexpress-dot-xtragrid-dot-views-dot-base-dot-columnviewoptionsbehavior-f16c97ad.md
Gets or sets a value which specifies how a cell editor is activated by the mouse.
Namespace : DevExpress.XtraGrid.Views.Base
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
[DefaultValue(EditorShowMode.Default)]
[XtraSerializableProperty]
public virtual EditorShowMode EditorShowMode { get; set; }
<DefaultValue(EditorShowMode.Default)>
<XtraSerializableProperty>
Public Overridable Property EditorShowMode As EditorShowMode
| Type | Default | Description |
|---|---|---|
| EditorShowMode | Default |
A EditorShowMode enumeration value which specifies how a cell editor is activated by the mouse.
|
Available values:
| Name | Description |
|---|---|
| Default |
The mode is not specified explicitly. The actual mode depends on the control and its settings. See remarks in the following topic for more information: EditorShowMode Enum.
| | MouseDown |
A cell editor is activated when the left mouse button is pressed regardless of whether the cell is focused.
| | MouseUp |
A cell editor is activated when the left mouse button is pressed and released in the same cell regardless of whether the cell is focused.
| | Click |
A cell editor is activated when the left mouse button is pressed and released in a focused cell.
| | MouseDownFocused |
A cell editor is activated when the left mouse button is pressed in a focused cell.
|
You can access this nested property as listed below:
| Object Type | Path to EditorShowMode |
|---|---|
| ColumnView |
.OptionsBehavior .EditorShowMode
|
See the EditorShowMode topic for information on the available editor activation modes.
If in-place editors must not be invoked on the first click (useful for browsing records with data editing support), set the EditorShowMode property to EditorShowMode.Click.
To support drag and drop operations within a View, set the EditorShowMode property to either EditorShowMode.MouseUp or EditorShowMode.Click.
If the EditorShowMode property is set to EditorShowMode.Default, the actual editor activation mode is determined by the current multiple selection mode. See the EditorShowMode.Default topic for more information.
Important
Starting with version 18.2, Auto Filter Row cells always invoke their editors on user clicks regardless of the EditorShowMode property value (i.e., these cells always function in the EditorShowMode.MouseDown mode). Currently, there is no option to revert this change back to the v18.1 state, but you can handle the ColumnView.ShownEditor event and manually select all cell text to allow end-users type in search criteria immediately after they click an Auto Filter Row cell.
private void GridView1_ShownEditor(object sender, EventArgs e)
{
GridView view = sender as GridView;
if(view.IsFilterRow(view.FocusedRowHandle))
{
view.ActiveEditor.MouseUp += Edit_MouseUp;
}
}
private void Edit_MouseUp(object sender, MouseEventArgs e)
{
TextEdit edit = sender as TextEdit;
edit.SelectAll();
edit.MouseUp -= Edit_MouseUp;
}
Private Sub GridView1_ShownEditor(ByVal sender As Object, ByVal e As EventArgs)
Dim view As GridView = TryCast(sender, GridView)
If view.IsFilterRow(view.FocusedRowHandle) Then
AddHandler view.ActiveEditor.MouseUp, AddressOf Edit_MouseUp
End If
End Sub
Private Sub Edit_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim edit As TextEdit = TryCast(sender, TextEdit)
edit.SelectAll()
RemoveHandler edit.MouseUp, AddressOf Edit_MouseUp
End Sub
Note that in MouseDown mode, the first click on a cell opens the editor, and then this mouse event is passed to the activated editor. For instance, if an in-place editor represents a ImageComboBoxEdit control, clicking a cell activates the editor and immediately opens its dropdown. In Click and MouseUp modes, the first click on a cell is not passed to the cell’s in-place editor. For instance, in MouseUp mode, if an in-place editor represents a ImageComboBoxEdit control, the first click activates the editor. The editor’s dropdown is opened by the second click.
If the CTRL, ALT or SHIFT modifier key is pressed while clicking a cell, the cell is focused, but the cell editor is not activated.
The following code snippets (auto-collected from DevExpress Examples) contain references to the EditorShowMode property.
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.
gridListEditor.GridView.CustomRowCellEditForEditing += gridView_CustomRowCellEdit;
gridListEditor.GridView.OptionsBehavior.EditorShowMode = EditorShowMode.MouseDown;
}
winforms-grid-double-click-row-cell/CS/DoubleClickCell/Form1.cs#L47
gridView1.OptionsBehavior.Editable = true;
gridView1.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.Click;
gridView1.DoubleClick += gridView1_DoubleClick;
winforms-grid-move-cell-using-drag-drop/CS/Form1.cs#L18
WindowState = FormWindowState.Maximized;
gridView1.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDownFocused;
gridView1.OptionsSelection.MultiSelect = true;
winforms-grid-multi-cell-editing/CS/MultiSelectionEditingHelper.cs#L22
this.view = view;
this.view.OptionsBehavior.EditorShowMode = EditorShowMode.MouseDownFocused;
this.view.MouseUp += view_MouseUp;
drag-drop-grid-rows-to-treelist/CS/DragAndDropRows/Form1.cs#L37
// Enable support for drag-and-drop operations within the View.
gridView.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.Click;
}
winforms-grid-double-click-row-cell/VB/DoubleClickCell/Form1.vb#L45
gridView1.OptionsBehavior.Editable = True
gridView1.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.Click
AddHandler gridView1.DoubleClick, AddressOf gridView1_DoubleClick
winforms-grid-move-cell-using-drag-drop/VB/Form1.vb#L17
WindowState = FormWindowState.Maximized
gridView1.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDownFocused
gridView1.OptionsSelection.MultiSelect = True
winforms-grid-multi-cell-editing/VB/MultiSelectionEditingHelper.vb#L21
Me.view = view
Me.view.OptionsBehavior.EditorShowMode = EditorShowMode.MouseDownFocused
AddHandler Me.view.MouseUp, AddressOf view_MouseUp
drag-drop-grid-rows-to-treelist/VB/DragAndDropRows/Form1.vb#L36
' Enable support for drag-and-drop operations within the View.
gridView.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.Click
End Sub
winforms-grid-copy-cell-value-to-other-cells-by-dragging-its-right-bottom-edge/VB/Form1.vb#L20
gridView1.OptionsView.ColumnAutoWidth = False
gridView1.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDownFocused
gridView1.OptionsSelection.MultiSelect = True
See Also
ColumnViewOptionsBehavior Class