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

GridView in a ContentControl

1 Answer 58 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dave Navarro
Top achievements
Rank 2
Dave Navarro asked on 29 Aug 2011, 05:58 AM

Hello,

I'm importing an external .xap file via MEF (no Prism) into my main project. My external .xap file has a RadGridView in a UserControl that's being imported / injected to a <ContentControl x:Name="content" /> (that is of course on the main page).

My question is this; once I have my control imported, how do I get access to the RadGridView (that is inside of the ContentControl) with my C# code behind?

Do I need to use the FindName("ControlName") method of the ContentControl?

I assign the value like this; content.Content = SelectedMEFModule.Value; (yes, that's just a small part of the import code).

Any suggestions would be greatly appreciated?

Many thanks in advance,

~ Dave

1 Answer, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 30 Aug 2011, 09:52 AM
Hello Dave Navarro,

You can try with the ChildrenOfType extension method. You will need to add Using Telerik.Windows.Controls ,and then you can get the RadGridView with something like :

MyContentControl.ChildrenOfType<RadGridView>().First();

Kind regards,
Pavel Pavlov
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 >>

Tags
GridView
Asked by
Dave Navarro
Top achievements
Rank 2
Answers by
Pavel Pavlov
Telerik team
Share this question
or