RadDocking - Created RadPaneGroups have no name when OnPreviewShowCompass events is fired

1 Answer 106 Views
Docking
B
Top achievements
Rank 1
B asked on 18 Aug 2021, 01:55 PM | edited on 18 Aug 2021, 01:59 PM

Hi All!

I solve the problem to disable of some RadPanes to drop on a specific RadPaneGroup. RadPane groups are created in xaml with a defined Name (also Tag has been tested):

 

<telerik:RadSplitContainer InitialPosition="DockedLeft">
        <telerik:RadPaneGroup x:Name="Left"/>
</telerik:RadSplitContainer>

In a custom docking panes factory the each RadPane (Tag contains position - string, e.g. Left) is correctly added into the specific RadPaneGroup based on the Name specified above. All the RadPanes are correctly added.

protected override void AddPane(Telerik.Windows.Controls.RadDocking radDocking, Telerik.Windows.Controls.RadPane pane) { var tag = pane.Tag.ToString(); if (radDocking.SplitItems.ToList().FirstOrDefault(i => i.Control.Name.Contains(tag)) is RadPaneGroup paneGroup) { paneGroup.Items.Add(pane); } else { base.AddPane(radDocking, pane);

} }

 

OnPreviewShowCompass event is used to allow a RadPane to drop on a specific RadPaneGroup. However, in the argument of this method (PreviewShowCompassEventArgs e) the Name property in e.TargetGroup is empty. But a given TargetGroup (RadPaneGroup) contains the correct number and types of RadPanes.
I cannot understand why Name property is empty, it should be specified based on xaml and a reference to this should be taken.

Thank you.

Radek

 

 

1 Answer, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 23 Aug 2021, 08:38 AM

Hello Radek,

Thank you for the provided information. 

I tested this scenario in the CustomDockingPanesFactory SDK example, however I was not able to observe the described behavior. On my end the names of the groups in the PreviewShowCompass event are the ones that are set in xaml. That is why I am attaching the sample project, which I used for testing for your reference. 

May I ask you to check out the shared project to see whether the same behavior is replicated in it? If that is the case, can you share some sample steps, which I can follow on my end? Alternatively, you can modify the project in order to demonstrate your scenario and send it back. This will hopefully allow me to investigate further and better assist you. 

I am looking forward to your reply.  

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.

B
Top achievements
Rank 1
commented on 03 Sep 2021, 12:14 PM

Hello Vladimir,

thank you for your answer. I've found where the problem is - it occures if the layout is saved. It seems that Name property is not stored into layout xml file.  I've attached the example, where the save layout is used. If it is commented (ShellViewModel.cs, row: 53), everything is ok. If layout is loaded, the Name property is empty...


<?xml version="1.0" encoding="utf-8"?>
<RadDocking>
	<DocumentHost>
		<RadSplitContainer>
			<Items>
				<RadPaneGroup SelectedIndex="0">
					<Items>
						<RadDocumentPane SerializationTag="Document Panel" IsPinned="True" IsDockable="True" Header="Document Panel 1" CanUserClose="True" />
					</Items>
				</RadPaneGroup>
			</Items>
		</RadSplitContainer>
	</DocumentHost>
	<SplitContainers>
		<RadSplitContainer Dock="DockedBottom" Height="180" RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True">
			<Items>
				<RadPaneGroup RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True" SelectedIndex="0">
					<Items>
						<RadPane SerializationTag="Bottom Panel" IsDockable="True" Header="Bottom Panel 1" CanUserClose="False" />
					</Items>
				</RadPaneGroup>
			</Items>
		</RadSplitContainer>
		<RadSplitContainer Dock="DockedLeft" Width="355" Orientation="Vertical">
			<Items>
				<RadPaneGroup SelectedIndex="-1">
					<Items />
				</RadPaneGroup>
				<RadPaneGroup RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True" SelectedIndex="0">
					<Items>
						<RadPane SerializationTag="Left Panel" IsDockable="True" Header="Left Panel 1" CanUserClose="False" />
					</Items>
				</RadPaneGroup>
				<RadPaneGroup RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True" SelectedIndex="0">
					<Items>
						<RadPane SerializationTag="Right Panel" IsDockable="True" Header="Right Panel 1" CanUserClose="False" />
					</Items>
				</RadPaneGroup>
			</Items>
		</RadSplitContainer>
		<RadSplitContainer Dock="DockedBottom" Height="180">
			<Items>
				<RadPaneGroup SelectedIndex="-1">
					<Items />
				</RadPaneGroup>
			</Items>
		</RadSplitContainer>
		<RadSplitContainer Dock="DockedRight" Width="240">
			<Items>
				<RadPaneGroup SelectedIndex="-1">
					<Items />
				</RadPaneGroup>
			</Items>
		</RadSplitContainer>
	</SplitContainers>
</RadDocking>

The example is little bit more complicated,  as I tried to make similar one as I use..
Please, can you comment me attached example..

Thank you.

Radek

Vladimir Stoyanov
Telerik team
commented on 08 Sep 2021, 09:06 AM

Hello Radek,

In order to save the Name properties of the RadPaneGroup elements you can make sure to set the SerializationTag attached property on them and utilize the ElementLayoutSaving and ElementLoading events in order to save/load the Name values. 

I am attaching the sample project modified to demonstrate this approach. 

Hope you find this helpful.

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