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
435
Row Click and Row Double Click event
posted

Hi All,

 

I'm facing one problem i want to do some operation when user single click on the row

and i have to perform some other operation when user double clicks on row.

 

Right now i using "AfterRowActivate" and "DoubleClickRow" events but every time when i'm double clicking row "AfterRowActivate" event is firing always.

 

Is there any way i can achieve both event separately.?

 

Thanks

 

Amit

 

 

Parents
No Data
Reply
  • 69832
    Suggested Answer
    Offline posted

    You can handle the control's MouseClick event and hit test for a row like so:

    void ultraGrid_MouseClick(object sender, MouseEventArgs e)
    {
        UltraGrid grid = sender as UltraGrid;
        UIElement controlElement = grid.DisplayLayout.UIElement;
        UIElement elementAtPoint = controlElement != null ? controlElement.ElementFromPoint( e.Location ) : null;
        UltraGridRow rowAtPoint = elementAtPoint != null ? elementAtPoint.GetContext( typeof(UltraGridRow) ) as UltraGridRow : null;

        if ( rowAtPoint != null )
        {
        }
    }

    In order to receive mutually exclusive notifications for a click and double-click, you can start a timer in response to MouseClick, using the SystemInformation.DoubleClickTime as the interval, and kill that timer if the RowDoubleClick event fires. If RowDoubleClick does not fire, the timer will be allowed to elapse, and you can then assume that the click was not part of a double-click.

Children
No Data