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

Get GridViewRow by MouseDoubleClick

2 Answers 66 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kim Bouchard
Top achievements
Rank 1
Kim Bouchard asked on 23 Aug 2012, 02:13 PM
Hi,

i want to get the coressponding GridViewRow when i did a DoubleClick insinde RadGridView.
Insinde my RadGridView's MouseDoubleClick event handler i have the following code

var s = e.OriginalSource as FrameworkElement;

var parentRow = s.ParentOfType<GridViewRow>();

if (parentRow != null)

{

     MyDataItem item = (MyDataItem)parentRow.Item;

}


parentRow is always null.
I thought ParentOfType<T> walks up the visual tree until it finds a type of T regardless of how many
levels it has to walk up !?

Did i get something wrong ?
I am using WPF Q2 2012 controls.

Kind Regards
Kim

2 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 23 Aug 2012, 02:26 PM
Hi,

 I have tested the described situation but I was not able to reproduce any issue. Please find attached a demo solution showing that the parent row is available as expected.

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Kim Bouchard
Top achievements
Rank 1
answered on 23 Aug 2012, 02:47 PM
Thanks for your quick reply Didie !

Your demo has guided me on the right path.
Your RadGridView is read only and mine was not.
So i think when RadGridView turns into row editing by double clicking a row
there is no GridViewRow to find.

When i set my RadGridView to read only too, everthing works as expected.

Thanks !
Kind Regards
Kim
Tags
GridView
Asked by
Kim Bouchard
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Kim Bouchard
Top achievements
Rank 1
Share this question
or