Get Name/Titel od Pane out of loaded Usercontrol

2 posts, 0 answers
  1. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 08 Feb 2013 Link to this post

    Hi,

    i need to get the name or titel from the pane where the Usercontrol is loaded. In The ElementLoaded-Event a add
    a UserControl to the content of the pane.

    On loading the Usercontrol i have to now the name or titel of the pane in which the control is loaded.

    How do i do this?

    thanks
    best Regards
    rene
  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 13 Feb 2013 Link to this post

    Hi Rene,

    In order to get the RadPane in which your custom UserControl is placed all you need to do is in its Loaded event cast the sender as your custom UserControl and then access the RadPane from the Parent property of that UserControl.

    The next code snippet shows how the Loaded event of your custom UserControl should look like:
    private void MyUserControlLoaded(object sender, RoutedEventArgs e)
    {
        var myUserControl = sender as MyUserControl;
        var pane = myUserControl.Parent as RadPane;
    }

    Hope this is helpful.

    Regards,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top