Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1315
Catch double click on Data Row
posted

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

Parents
  • 69832
    Suggested Answer
    Offline posted

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

Reply Children
No Data