Description:
How do I handle the MouseUp event within a GridView, when I click a cell? It works fine when I click the Column Header for example.
Answer:
Please note, if the View's OptionsBehavior.Editable property is true, the MouseUp is processed by the in-place editor (which opens when you click for the first time). If you need to catch the moment when the end-user moves the mouse up within the editor, you should handle the view's ShownEditor and write an event handler for the MouseUp event of the editor:
C#private void gridView1_ShownEditor(object sender, System.EventArgs e) {
gridView1.ActiveEditor.MouseUp += new MouseEventHandler(ActiveEditor_MouseUp);
}
private void ActiveEditor_MouseUp(object sender, MouseEventArgs e) {
//DO something
}
Visual BasicPrivate Sub GridView1_ShownEditor(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GridView1.ShownEditor
AddHandler GridView1.ActiveEditor.MouseUp, AddressOf ActiveEditor_MouseUp
End Sub
Private Sub ActiveEditor_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
'DO SOMETHING
End Sub
See Also:
Why is the DoubleClick event for the GridView not triggered?
How to make the grid activate its in-place editor on double click only