Hi
I have a UltraWinGrid with many rows, When user double clicks on a row, Application leads to details of that row.
I use Grid_DoubleClick event for this.
But even when user clicks twice on scroll bar, this event is fired and detail screen pops up.
How could I catch double click only on data row?
Thanks
Shivangi
You should use MouseDoubleClick instead (better because it gives you the point that was clicked, and it is expressed in client coordinates). In the event handler, you could cast the sender to an UltraGrid, get the UltraGrid.DisplayLayout.UIElement, and use ElementFromPoint to find the RowUIElement that was double-clicked (if any).
Example:void ultraGrid_MouseDoubleClick(object sender, MouseEventArgs e){ UltraGrid control = sender as UltraGrid; UIElement controlElement = control != null ? control.DisplayLayout.UIElement : null; UIElement elementAtPoint = controlElement != null ? controlElement.ElementFromPoint(e.Location) : null;
UltraGridRow row = null; while ( elementAtPoint != null ) { RowUIElement rowElement = elementAtPoint as RowUIElement; if ( rowElement != null ) { row = rowElement.Row; break; }
elementAtPoint = elementAtPoint.Parent; }
if ( row != null ) { // If you get in here a row was double-clicked. }}
Hi Brian,
I understand your point but I need to develope this application in Visual studio 2002 and it does not include MouseDoubleClick event, thus I am using this work around.