GridView in a ContentControl

2 posts, 0 answers
  1. Dave Navarro
    Dave Navarro avatar
    150 posts
    Member since:
    Jul 2005

    Posted 29 Aug 2011 Link to this post

    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

  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 30 Aug 2011 Link to this post

    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 >>

  3. DevCraft banner
Back to Top