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

Load mypage.xaml into radpane?

2 Answers 77 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Randy Hompesch
Top achievements
Rank 1
Randy Hompesch asked on 05 Jul 2016, 07:29 PM

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"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:QI.Pages"
      mc:Ignorable="d"
      d:DesignHeight="300" d:DesignWidth="300"
      Title="Test">

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

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"
                            VerticalAlignment="Stretch"
                            Grid.ColumnSpan="2"
                            RetainPaneSizeMode="DockingAndFloating" Grid.RowSpan="2"
                            >
            <telerik:RadSplitContainer Name="LeftContainer"  >
                <telerik:RadPaneGroup x:Name="rpgLeftGroup" >

                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>

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

                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
            </telerik:RadDocking.DocumentHost>
       
</telerik:RadDocking

 

2 Answers, 1 is accepted

Sort by
0
Polya
Telerik team
answered on 07 Jul 2016, 12:09 PM
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.

Regards,
Polya
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Randy Hompesch
Top achievements
Rank 1
answered on 07 Jul 2016, 03:44 PM

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

 

Tags
Docking
Asked by
Randy Hompesch
Top achievements
Rank 1
Answers by
Polya
Telerik team
Randy Hompesch
Top achievements
Rank 1
Share this question
or