KB Article A1035
Visible to All Users

How to make the grid activate its in-place editor on double click only

Description:
I wish the grid to go into cell editing mode if the user double-clicks it. Can I implement this?

Answer:
We suggest that you handle the View's MouseDown event in order to remember how many clicks an end-user has made and use ShowingEditor to prevent the in-place editor from being opened when only one click has been made.

C#
int ClickCount = -1; private void gridView1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if(e.Button == MouseButtons.Left) ClickCount = e.Clicks; } private void gridView1_ShowingEditor(object sender, System.ComponentModel.CancelEventArgs e) { e.Cancel = (ClickCount == 1); if (!e.Cancel) ClickCount = -1; }

Note, this code will only work if the OptionsBehavior.ShowEditorOnMouseUp is true.
(For newer versions:
the OptionsBehavior.EditorShowMode should be set to MouseUp)
See Also:
How to Disable the Immediate Opening of In-Place Editors

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.