Can a RadDocking be inside another RadDocking? Can the layout be saved in this setup?

1 Answer 20 Views
Docking
Pete
Top achievements
Rank 1
Iron
Iron
Iron
Pete asked on 08 Nov 2021, 05:11 PM

This is related to https://www.telerik.com/forums/radsplitcontainer-not-reporting-docking-state-or-width-height-correctly, I hadn't realised the XAML had a RadDocking inside another RadDocking.

The code looks like this:

<telerik:RadDocking Name="radDocking" telerik:RadDocking.SerializationTag="DockingTag">
            
            <telerik:RadSplitContainer Name="container" InitialPosition="DockedTop">
                <telerik:RadPaneGroup Name="ContainerGroup">
                    <telerik:RadDocumentPane Name="OutputPane" Header="Output"/>
                </telerik:RadPaneGroup>
                <telerik:RadPaneGroup Name="FormGroup">
                    <telerik:RadDocking>
                        <telerik:RadSplitContainer>
                            <telerik:RadPaneGroup>
                                <telerik:RadPane x:Name="Form1" Header="Form 1"/>
                            </telerik:RadPaneGroup>
                            <telerik:RadPaneGroup>
                                <telerik:RadPane x:Name="Form2" Header="Form 2"/>
                            </telerik:RadPaneGroup>
                        </telerik:RadSplitContainer>
                    </telerik:RadDocking>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
            
</telerik:RadDocking>

When the layout is saved (using radDocking.SaveLayout), I get this:

<RadDocking SerializationTag="DockingTag">
	<SplitContainers>
		<RadSplitContainer Dock="DockedTop" Height="359">
			<Items>
				<RadPaneGroup SelectedIndex="0">
					<Items>
						<RadDocumentPane IsDockable="True" Header="Output"/>
					</Items>
				</RadPaneGroup>
				<RadPaneGroup SelectedIndex="-1">
					<Items/>
				</RadPaneGroup>
			</Items>
		</RadSplitContainer>
	</SplitContainers>
</RadDocking>
This appears to have lost the two forms Form1 and Form2. How do I save layout with a RadDocking inside another?

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 11 Nov 2021, 01:02 PM

Hello Pete,

Thank you for the provided code snippets.

We do have an example in our SDK Samples Browser which demonstrates how to achieve this: Nested RadDocking Save and Load of layout.

In order to achieve Save/Load Layout for nested scenarios, you will simply need to save each RadDocking separately and load separately each of them afterward. The direction of the loading operation should be from the inner RadDockings to the outer ones in order to avoid any issues when loading floating RadPanes/RadPaneGroups.

For your convenience, I've attached the aforementioned demo to my reply. Please have a look and let me know if the same approach would work in your original application.

Regards,
Dilyan Traykov
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.

Pete
Top achievements
Rank 1
Iron
Iron
Iron
commented on 11 Nov 2021, 02:55 PM

Hi

I tried your sample and it works fine, so I updated my sample accordingly, however it doesn't work, so I've attached it in a ZIP file here. I note I couldn't use RadDocking.DocumentHost as that caused a null object exception on startup.

Pete

Dilyan Traykov
Telerik team
commented on 12 Nov 2021, 01:38 PM

Hi Pete,
Thank you for the provided project.
The reason why the nested docking is not persisted is that it needs to be hosted in a RadPane with a set SerializationTag.
After doing this, both of the controls are loaded as expected at my end. This also seems to resolve the exception with the DocumentHost.
Can you please test the attached project and let me know if it provides the desired result?
Pete
Top achievements
Rank 1
Iron
Iron
Iron
commented on 16 Nov 2021, 09:58 AM

You're sample does work. I've gone back to our application and noted the following:

  • the inner docking is inside a UserControl.
  • loading of inner before outer can be swapped, it still works (in the sample)
  • I don't need a DocumentHost for it to work
  • I don't need serialization tags for it to work
Dilyan Traykov
Telerik team
commented on 18 Nov 2021, 03:23 PM

Hi Pete,
I did not understand from your previous comment whether you've now managed to resolve the issue and have achieved the desired result in your application.
Can you please let me know whether this is indeed the case, and if not - how I can further assist you?
Tags
Docking
Asked by
Pete
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Dilyan Traykov
Telerik team
Share this question
or