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
315
How to detect when a row is clicked by user (mouse selection only, not keyboard).
posted

I need to perform an action when user specifically clicks a row with mouse.

AfterSelectChange event fires even when user selects the row using arrow keys. Also, it won't fire twice if I click the same row twice. Not desirable.

MouseClick event fires even when user clicks outside of the rows (group by area, headers, scrollbar, etc). So, this won't do either.

ClickCell event won't fire because CellClickAction = RowSelect.

Is there any property or arguments in some event that will do the job.

  • 9298
    Verified Answer
    posted

    You will find the answer in this article from our on-line documentation:

    http://help.infragistics.com/Help/NetAdvantage/WinForms/2012.2/CLR4.0/html/WinGrid_Determining_Which_Row_the_User_Clicked.html

     

    Handle the MouseUp event of the WinGrid and put in something like this:

    UIElement aUIElement =   this.ultraGrid1.DisplayLayout.UIElement.ElementFromPoint(new Point(e.X,e.Y));


     // Declare and retrieve a reference to the row

    UltraGridRow aRow = (UltraGridRow)aUIElement.GetContext(typeof(UltraGridRow));


     // If a row was found display the band and row index

    if(aRow != null)

     this.ultraTextEditor1.Text += "Band("   + aRow.Band.Index.ToString() + ") Row.Index=" + aRow.Index.ToString() + "\n";

    else

    this.ultraTextEditor1.Text += "* no row associated with this location *\n";

    Let use know if you have further questions.