Back to Devexpress

ColumnViewOptionsBehavior.EditorShowMode Property

windowsforms-devexpress-dot-xtragrid-dot-views-dot-base-dot-columnviewoptionsbehavior-f16c97ad.md

latest11.1 KB
Original Source

ColumnViewOptionsBehavior.EditorShowMode Property

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

Declaration

csharp
[DefaultValue(EditorShowMode.Default)]
[XtraSerializableProperty]
public virtual EditorShowMode EditorShowMode { get; set; }
vb
<DefaultValue(EditorShowMode.Default)>
<XtraSerializableProperty>
Public Overridable Property EditorShowMode As EditorShowMode

Property Value

TypeDefaultDescription
EditorShowModeDefault

A EditorShowMode enumeration value which specifies how a cell editor is activated by the mouse.

|

Available values:

NameDescription
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.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to EditorShowMode
ColumnView

.OptionsBehavior .EditorShowMode

|

Remarks

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.

csharp
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;
}
vb
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.

XAF-how-to-add-an-unbound-column-to-gridlisteditor-to-execute-a-custom-action-for-a-record/CS/EFCore/ButtonInListEF/ButtonInListEF.Win/Controllers/SimpleBusinessActionGridListViewController.cs#L37

csharp
gridListEditor.GridView.CustomRowCellEditForEditing += gridView_CustomRowCellEdit;
    gridListEditor.GridView.OptionsBehavior.EditorShowMode = EditorShowMode.MouseDown;
}

winforms-grid-double-click-row-cell/CS/DoubleClickCell/Form1.cs#L47

csharp
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

csharp
WindowState = FormWindowState.Maximized;
gridView1.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDownFocused;
gridView1.OptionsSelection.MultiSelect = true;

winforms-grid-multi-cell-editing/CS/MultiSelectionEditingHelper.cs#L22

csharp
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

csharp
// 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

vb
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

vb
WindowState = FormWindowState.Maximized
gridView1.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDownFocused
gridView1.OptionsSelection.MultiSelect = True

winforms-grid-multi-cell-editing/VB/MultiSelectionEditingHelper.vb#L21

vb
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

vb
' 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

vb
gridView1.OptionsView.ColumnAutoWidth = False
gridView1.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDownFocused
gridView1.OptionsSelection.MultiSelect = True

See Also

AutoSelectAllInEditor

MultiSelect

MultiSelectMode

ColumnViewOptionsBehavior Class

ColumnViewOptionsBehavior Members

DevExpress.XtraGrid.Views.Base Namespace