Mouse selects rows while dragging scroll bar

6 posts, 1 answers
  1. Grant Fish
    Grant Fish avatar
    10 posts
    Member since:
    Apr 2010

    Posted 06 May 2011 Link to this post

    We are updating from 2010Q1 to 2011Q1 and I am experiencing some very strange behavior with the scroll bars. If you drag the slider in a scroll bar (vertical or horizontal) and the mouse pointer deviates into the grid cells, the mouse starts selecting rows. This means that the user must be careful to never allow the mouse pointer to wander into the grid while dragging the scroll bar sliders. The scroll bar slider still moves, but normally if you start dragging a scroll bar slider with the mouse that is all that the mouse should do until the pointer is released.

    We have full row select and multi-select enabled.
  2. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 06 May 2011 Link to this post

    Hello Grant,

    There is an issue with the latest release, you can use this workaround until the next official release:
    BaseGridBehavior baseGridBehavior = this.radGridView1.GridBehavior as BaseGridBehavior;
    baseGridBehavior.UnregisterBehavior(typeof(GridViewDataRowInfo));
    baseGridBehavior.RegisterBehavior(typeof(GridViewDataRowInfo), new CustomGridDataRowBehavior());
      
    public class CustomGridDataRowBehavior : GridDataRowBehavior
    {
        private GridRowElement rowElement;
      
        protected override bool OnMouseDownLeft(MouseEventArgs e)
        {
            this.rowElement = this.GetRowAtPoint(this.GridViewElement.ElementTree, e.Location);
            return base.OnMouseDownLeft(e);
        }
      
        public override bool OnMouseMove(MouseEventArgs e)
        {
            if (this.rowElement == null)
            {
                return false;
            }
      
            return base.OnMouseMove(e);
        }
      
        private GridRowElement GetRowAtPoint(ComponentElementTree componentTree, Point point)
        {
            RadElement elementUnderMouse = componentTree.GetElementAtPoint(point);
      
            while (elementUnderMouse != null)
            {
                GridRowElement item = elementUnderMouse as GridRowElement;
      
                if (item != null)
                {
                    return item;
                }
      
                elementUnderMouse = elementUnderMouse.Parent;
            }
      
            return null;
        }
    }

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga

    Telerik WinForms MVP
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Joe Sugden
    Joe Sugden avatar
    52 posts
    Member since:
    Feb 2010

    Posted 02 Sep 2011 Link to this post

    Hi,

    This workaround worked like a charm on most of our grids, except for one. I suspect it could be because it has children grids, but I'm not sure. Could it be some conflicting property values that prevented the custom behavior from working? 

    Has this been fixed yet? We're still on Q1 2011.

    Thank you.
  5. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 02 Sep 2011 Link to this post

    Hello Joe,

    Thank you for contacting us. Yes, we believe that this issue is addressed in our latest release - Q2 2011 SP1. I would recommend that you try it. However, if you continue to experience the issue, please open a new support ticket and send us your application and we will try to find a proper solution. 

    In case you have other questions, we will be glad to help.
     
    Kind regards,
    Jack
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  6. Bhakti
    Bhakti avatar
    23 posts
    Member since:
    Jan 2011

    Posted 13 Mar 2013 Link to this post

    hello can u send me a example of this kind. Im using a radgirdview.
  7. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 14 Mar 2013 Link to this post

    Hello Bhakti,

    This issue is addressed in our latest release. I noticed that you are using an old version of RadControls for WinForms and I recommend that you try our latest version - Q1 2013. It contains many new controls and addresses a lot of issues. 

    Regarding the described issue, you can check our demo application which contains a handful examples for RadGridView. If you still observe the issue, please describe the exact scenario and send us a sample application where it can be reproduced. We will be glad to help further.

    I am looking forward to your reply.

    Regards,
    Jack
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Back to Top
UI for WinForms is Visual Studio 2017 Ready