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