Transform RadDocumentHost content in control

1 Answer 17 Views
Docking TabControl
Deltaohm
Top achievements
Rank 1
Iron
Deltaohm asked on 27 Aug 2021, 12:38 PM | edited on 27 Aug 2021, 12:40 PM

Hi,

I have a dynamic structure managed with RadDocking, that works well.


<t:RadDocking x:Name="radDocking1"
                            RetainPaneSizeMode="DockingAndFloating"
                            CanAutoHideAreaExceedScreen="True"
                            Grid.Row="1" Margin="0 0 0 10"                            
                            BorderThickness="0"
							CloseButtonPosition="InPane"
                            Padding="0"
							Close="radDocking1_Close">
				<t:RadDocking.DocumentHost>
					<t:RadSplitContainer >
						<t:RadPaneGroup x:Name="_tabPlot" 
									SelectedIndex="{Binding TabAttivo}">
							<t:RadPaneGroup.Resources>
								<DataTemplate x:Uid="DataTemplate_1" 
										  x:Key="{x:Static r:ResourcesKeys.TabContent}" DataType="WpfPlot">
									<t:RadDocking RetainPaneSizeMode="DockingAndFloating" DataContext="{Binding}"
											  Background="{Binding IsSampled, Converter={StaticResource SampledToColor}}">
										<t:RadDocking.DocumentHost>
...

 But it was too complex and I transformed the part inside the more extern DocumentHost in a user control.

<UserControl x:Class="DeltaOhm.NsModules.View.MainPlotControl"
             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:DeltaOhm.NsModules.View"
			 xmlns:r="clr-namespace:DeltaOhm.NsModules.ResourceDictionaries"
		     xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
			 xmlns:t="http://schemas.telerik.com/2008/xaml/presentation"
			 xmlns:vm="clr-namespace:DeltaOhm.NsModules.ViewModel" 
			 d:DataContext="{d:DesignInstance Type=vm:MainWindowViewModel}"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">

	
	<t:RadSplitContainer x:Name="_mainContainer" >
		<t:RadPaneGroup>
			<t:RadPaneGroup x:Name="_tabPlot" 
						SelectedIndex="{Binding TabAttivo}">
				<t:RadPaneGroup.Resources>
					<DataTemplate x:Key="{x:Static r:ResourcesKeys.TabContent}" DataType="WpfPlot">
						<t:RadDocking RetainPaneSizeMode="DockingAndFloating" DataContext="{Binding}"
											  Background="{Binding IsSampled, Converter={StaticResource SampledToColor}}">
							<t:RadDocking.DocumentHost>
								

Now, I tried many combinations of  radsplitcontainer/RadPaneGroup in and out of user control, but the best that I get was :

<UserControl x:Class="DeltaOhm.NsModules.View.MainPlotControl"
             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:DeltaOhm.NsModules.View"
			 xmlns:r="clr-namespace:DeltaOhm.NsModules.ResourceDictionaries"
		     xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
			 xmlns:t="http://schemas.telerik.com/2008/xaml/presentation"
			 xmlns:vm="clr-namespace:DeltaOhm.NsModules.ViewModel" 
			 d:DataContext="{d:DesignInstance Type=vm:MainWindowViewModel}"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">

	
	<Grid>
		<t:RadSplitContainer x:Name="_mainContainer" >
				<t:RadPaneGroup x:Name="_tabPlot" 
						SelectedIndex="{Binding TabAttivo}">
				<t:RadPaneGroup.Resources>
					<DataTemplate x:Key="{x:Static r:ResourcesKeys.TabContent}" DataType="WpfPlot">
						<t:RadDocking RetainPaneSizeMode="DockingAndFloating" DataContext="{Binding}"
											  Background="{Binding IsSampled, Converter={StaticResource SampledToColor}}">
							<t:RadDocking.DocumentHost>
								<t:RadDocking >

And in the original position:

<t:RadDocking.DocumentHost>
						<Grid><local:MainPlotControl x:Name="_mainPlot"/></Grid>
				</t:RadDocking.DocumentHost>

The result is similar but not identical

vs

I would like to follow this way to split the code, but i would like to get the second layout, are there any solutions?

 Thank you in advance

Luigi

1 Answer, 1 is accepted

Sort by
0
Accepted
Vladimir Stoyanov
Telerik team
answered on 01 Sep 2021, 10:19 AM

Hello Luigi,

Thank you for the shared pictures. 

My current understanding is that you want to extract the xaml inside the DocumentHost of the RadDocking in a separate file. Feel free to correct me, if I am wrong and elaborate on what you are trying to achieve.

Note, that the DocumentHost of the RadDocking should be a RadSplitContainer. With this in mind, you can replace the UserControl for a RadSplitContainer in the second file.

I am attaching a sample project demonstrating what I have in mind. Please, check it out and let me know, if it helps. 

Regards,
Vladimir Stoyanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Deltaohm
Top achievements
Rank 1
Iron
commented on 02 Sep 2021, 09:16 AM

Thank you Vladimir,

That is exactly what I need.

Luigi

Tags
Docking TabControl
Asked by
Deltaohm
Top achievements
Rank 1
Iron
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or