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
70
Grid Click separate header click
posted

We were using the AfterSelectChange Event to know when a record is selected.  Problem is there are instances when they need to click the same row again, so trying to move to the Click or MouseUp Event, but that fires on header click as well.  I'm using some code to determine if it's a row click and it works as opposed to open space below rows, but still counts the header as the first row.

I need to have an event(whatever event) fire and only run if an actual row is selected, not the header.  I feel like I'm missing something right in front of me.

I tried using this in the MouseUp event

            Infragistics.Win.UIElement aUIElement= dgOpen.DisplayLayout.UIElement.ElementFromPoint(new Point(e.X, e.Y));
            UltraGridRow aRow= (UltraGridRow) aUIElement.GetContext(typeof(UltraGridRow));
    
            // if a row was found display the band and row index
            if (aRow != null)
            {

Which gets me a good chunk there, but still includes the header.

Parents
No Data
Reply
  • 69832
    Suggested Answer
    Offline posted

    One thing to note is that you won't get a MouseUp if the cell goes into edit mode on the MouseDown. If you can handle MouseDOwn instead, you can use the ElementFromPoint method to hit test for a CellUIElement, which will filter out hits on the row selector, like so:

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

        while ( elementAtPoint != null )
        {
            CellUIElement cellElement = elementAtPoint as CellUIElement;
            if ( cellElement != null )
            {
                rowAtPoint = cellElement.Row;
                break;
            }

            elementAtPoint = elementAtPoint.Parent;
        }

        if ( rowAtPoint != null )
        {
            //  TODO: You are here.
        }
    }

Children
No Data