This is a migrated thread and some comments may be shown as answers.

Mouse selects rows while dragging scroll bar

5 Answers 112 Views
GridView
This is a migrated thread and some comments may be shown as answers.
IT Department
Top achievements
Rank 1
IT Department asked on 06 May 2011, 06:56 PM
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.

5 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 06 May 2011, 07:42 PM
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
0
Joe Sugden
Top achievements
Rank 1
answered on 02 Sep 2011, 02:12 PM
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.
0
Jack
Telerik team
answered on 02 Sep 2011, 04:33 PM
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 >>

0
Bhakti
Top achievements
Rank 1
answered on 13 Mar 2013, 09:00 PM
hello can u send me a example of this kind. Im using a radgirdview.
0
Jack
Telerik team
answered on 14 Mar 2013, 02:45 PM
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.
Tags
GridView
Asked by
IT Department
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Joe Sugden
Top achievements
Rank 1
Jack
Telerik team
Bhakti
Top achievements
Rank 1
Share this question
or