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
125
How to get the rowIndex from mouseCickPosition?
posted

When cilck ultraGrid  by RightMouseButton .How to get the rowIndex from mouseCickPosition ?

Thanks!

  • 69832
    Offline posted

    void ultraGrid_MouseClick(object sender, MouseEventArgs e)
    {
        if ( e.Button == MouseButtons.Right )
        {
            UltraGrid control = sender as UltraGrid;
            UIElement controlElement = control.DisplayLayout.UIElement;
            UIElement elementAtPoint = controlElement != null ? controlElement.ElementFromPoint( e.Location ) : null;
            UltraGridRow row = elementAtPoint != null ? elementAtPoint.GetContext( typeof(UltraGridRow) ) as UltraGridRow : null;
            int index = row != null ? row.Index : -1;
        }
    }