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

RadGridView MouseDoubleClick

1 Answer 167 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Orit
Top achievements
Rank 1
Orit asked on 10 Dec 2009, 07:10 AM
Hello
I have a Hierarchy grid
I add a MouseDoubleClick event both to my
parent and child grids
the problem is
when I double click the child
the event raise twice, once to the child and then to the parent.

1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 10 Dec 2009, 04:51 PM
Hello Orit,

This is natural since the mouse event are routed and they will travel up - when a double lick event is raised on a child element it will travel all the way up to the application (if not handled on its way)

One way to solve this issue is to have a simple  conditional statement in the event handler to determine if you are handling an event in a child or a parent grid. For example:

private void clubsGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
    var senderElement = e.OriginalSource as FrameworkElement;
    var dataControl = senderElement.ParentOfType<GridViewDataControl>();
  
    if (dataControl.ParentRow == null)
    {
        // click on the root grid
    }
    else
    {
        // click on a child grid
    }
}

Hope this helps.


Kind regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Orit
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or