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

Different row being highlighted during scroll

3 Answers 51 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 2
Martin asked on 01 Jun 2011, 03:14 PM
Is there any way to stop a different row from being highlighted when I'm scrolling through the grid view?

Currently using 2011 Q1 and can repeat it using the following steps.

  1. Create a RadGridView so that it contains enough rows to have a vertical and/or horizontal scroll bar
  2. Select a cell in the RadGridView
  3. Left mouse click (and hold) whilst scrolling the scrollbar, 'accidentally' hover over a new row/cell.
  4. This causes the row to be highlighted (as per screenshot).

3 Answers, 1 is accepted

Sort by
0
Martin
Top achievements
Rank 2
answered on 03 Jun 2011, 10:10 AM
Any ideas as to why this is happening; I'll open up a support ticket otherwise?
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 05 Jun 2011, 09:17 AM
Hello Martin,

This is a known problem, please use the following workaround until the next 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;
    }
}

If you have any more questions please just let me know, and if the question has been solved, please mark the question as answered, so that others can find the answers to their questions faster.

Best Regards,
Emanuel Varga


WinForms MVP
0
Alexander
Telerik team
answered on 06 Jun 2011, 09:16 AM
Hello Martin,

Thank you for writing.

I confirm the issue you report. In the case you describe, the hovered row in step 3 becomes selected and the row that is initially current and selected remains only current. It is not the desired behavior of RadGridView. I added it to our PITS. We will address the issue in a future release. Your Telerik points have been updated.

Due to the nature of the issue, I am not able to provide work-around for it. Please do not hesitate to contact us again if you have additional questions.

Best regards,
Alexander
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Tags
GridView
Asked by
Martin
Top achievements
Rank 2
Answers by
Martin
Top achievements
Rank 2
Emanuel Varga
Top achievements
Rank 1
Alexander
Telerik team
Share this question
or