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
4160
How can I get the row given the point?
posted

Hello

I would like to get a reference of the row where the user pressed the right mouse button (that is, within the MouseDown event handler).

How can I do that? 

Thanks a lot.

  • 469350
    Verified Answer
    Offline posted
  • 280
    posted

    Hi man,

    use this:

     

    if (e.Button == MouseButtons.Right) {

            UIElement el = this.GridServices.DisplayLayout.UIElement.LastElementEntered;

            if (el != null) {

                    if (this.GridServices.ActiveRow != null) {                        

                            this.GridServices.ActiveRow.Selected = false;

                            this.GridServices.ActiveRow = null;

            }

            UltraGridRow row = el.GetContext(typeof(UltraGridRow), true) as UltraGridRow;

             if (row != null) {

                    this.GridServices.ActiveRow = row;

                    this.GridServices.ActiveRow.Selected = true;

            }

    }

     

    Hope that helped

    Nassos