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

[Solved] How to get RowDetailTemplate 's VisualParent

2 Answers 104 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
KocSistem
Top achievements
Rank 1
KocSistem asked on 19 Aug 2010, 07:59 AM
Hello Telerik Team,

in my project i have a RadGridView that has a custom user control for it's RowDetailTemplate.

<Controls:RadGridView Name="grdPlayerScreens" CanUserFreezeColumns="False"  Grid.Row="2" 
                                  RowDetailsVisibilityMode="VisibleWhenSelected" RowDetailsTemplate="{StaticResource ScreenConfigEditDetailsTemplates}"
AutoGenerateColumns="False" EnableColumnVirtualization="False"    ScrollMode="RealTime" IsReadOnly="True" RowIndicatorVisibility="Collapsed">
<Controls:RadGridView.Columns>
   <Controls:GridViewDataColumn UniqueName="RSScreenConfig.Power" Header="Power" />
   <Controls:GridViewDataColumn UniqueName="RSScreenConfig.Volume" Header="Volume" />
   <Controls:GridViewDataColumn UniqueName="RSScreenConfig.Brightness" Header="Brightness" />
   <Controls:GridViewDataColumn UniqueName="RSScreenConfig.Contrast" Header="Contrast"/>
   <Controls:GridViewDataColumn UniqueName="RSScreenConfig.Color" Header="Color" />
   <Controls:GridViewDataColumn UniqueName="RSScreenConfig.Sharpness" Header="Sharpness"/>
   <Controls:GridViewDataColumn UniqueName="RSScreenConfig.BackLight" Header="BackLight" />
   <Controls:GridViewDataColumn UniqueName="RSScreenConfig.PictureMode" Header="Picture Mode"/>
   <Controls:GridViewDataColumn UniqueName="RSScreenConfig.PortName" Header="Port"/>
   <Controls:GridViewDataColumn UniqueName="RSSourceType.SourceName" Header="Source"/>
</Controls:RadGridView.Columns>
  
                    </Controls:RadGridView>

In each Custom control in RowDetailTemplate I need to reach to some data in the parent RadGridView. How can i reach them? I tried this.Parent which turns out to be null, i tried some VisualTreeHelper but couldn't make it work.

Regards

2 Answers, 1 is accepted

Sort by
0
Accepted
Rossen Hristov
Telerik team
answered on 19 Aug 2010, 08:02 AM
Hi KOCSISTEM BILGI VE ILETISIM HIZMETLERI A.S,

You can create a property on your control that will hold the parent grid. Then you can attach to the LoadingRowDetails event and pass in RadGridView, i.e. the sender, to this property of the user control. Your user control will be e.DetailsElement, so you can cast it and assign the grid.

I hope this helps.

All the best,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
KocSistem
Top achievements
Rank 1
answered on 19 Aug 2010, 08:29 AM
Wonderful, thanks.
Tags
GridView
Asked by
KocSistem
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
KocSistem
Top achievements
Rank 1
Share this question
or