Load mypage.xaml into radpane?

3 posts, 0 answers
  1. Randy Hompesch
    Randy Hompesch avatar
    148 posts
    Member since:
    Nov 2008

    Posted 05 Jul 2016 Link to this post

    I'm just dipping my toes into the wpf water and am trying to get up to speed.

    I have a RadDocking control on my main page as shown below.

    I want to, in response to a button click or some other event, create a pane in code-behind that loads a page's xaml into the content of the pane.

    So, for example, I have a page defined:

    <Page x:Class="QI.Pages.Test"
          d:DesignHeight="300" d:DesignWidth="300"

            <TextBlock Text="Hello"></TextBlock>

    I want to create a pane that contains the page shown above and add it to the rpgRightGroup defined below.

    Can someone help me get there from here?

    Thanks ... Ed



    <telerik:RadDocking x:Name="radDock" HasDocumentHost="True"
                                HorizontalAlignment="Stretch"  Grid.Row="2"
                                RetainPaneSizeMode="DockingAndFloating" Grid.RowSpan="2"
                <telerik:RadSplitContainer Name="LeftContainer"  >
                    <telerik:RadPaneGroup x:Name="rpgLeftGroup" >


                    <telerik:RadSplitContainer Name="RightContainer">
                        <telerik:RadPaneGroup x:Name="rpgRightGroup"  >



  2. Polya
    Polya avatar
    267 posts

    Posted 07 Jul 2016 Link to this post

    Hello Randy,

    In WPF, a Page can be hosted in Window or Frame only. It is mostly used for web-based systems like an XBAP, where you have a single browser window and different pages can be hosted in that window.
    A UserControl, on the other hand is reusable control that can be added to UI element's content the same way any other control can.

    That said, instead of using a page, you can host the desired content in a user control. Then, in the button click handler you can create a new RadPane and add the user control as its Content.

    I've created a sample project demonstrating this approach. Please find it attached.

    Hope this helps.

    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. Randy Hompesch
    Randy Hompesch avatar
    148 posts
    Member since:
    Nov 2008

    Posted 07 Jul 2016 in reply to Polya Link to this post

    A 1000 thanks! Exactly what I needed. I got it working with a page but it felt like a hack and I knew there had to be a better way.

    Thanks again ... Ed


Back to Top