
Is there a way to preserve my RadPane content when I load the layout?
I have the following XAML:
<telerik:RadPane x:Name="rpIndexPane" CanUserClose="False" ContextMenuTemplate="{x:Null}" CanDockInDocumentHost="False" Header="Index"
telerik:RadDocking.SerializationTag="IndexPane" DataContext="{Binding}">
<ItemsControl DataContext="{Binding}" ItemsSource="{Binding ActiveJob.Patient.CurrentVisit.Sections.Items}" HorizontalContentAlignment="Stretch">
<ItemsControl.Template>
<ControlTemplate TargetType="ItemsControl">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ItemsPresenter/>
</ScrollViewer>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Background="{Binding Color}" Margin="1" Visibility="{Binding Visible, Converter={StaticResource BoolToVisConverter}}">
<TextBlock Text="{Binding Name}" Margin="3,5,3,5" HorizontalAlignment="Center"></TextBlock>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</telerik:RadPane>
16 Answers, 1 is accepted
Thank you for contacting us.
Have you reviewed this 2 articles about Load/Save Layout - http://www.telerik.com/help/wpf/raddocking-save-load-the-content-of-the-panes.html and http://www.telerik.com/help/wpf/raddocking-features-save-load-layout.html?
If they does not help you could you please send us a sample project in which this issue is reproduced. In that way we will be able to assist you in a timely manner.
If you have further questions please let us know.
Greetings,
Konstantina
the Telerik team

I've the same problem that you and I saw the 2 articles. The save and load method works fine but the binding doesn't persist.
I tried to implement something that look like the first article. However, they talk about a GetPaneContent method to set the content of the pane but I never see it in any classes (radDocking, radPane, UserControl, Window,...)...
Anyone knows where we can find this famous method because it looks like the lonely solution...
Thank you for your participation in the discussion.
This method is just for an example purposes. You will need to implement it yourself to fit your requirements.
Hope this information helps. If you need further assistance please let us know.
Kind regards,
Konstantina
the Telerik team

I,ve tried to follow the sample to save and load layout and content of panes, using the code below.
But i cannot find the "GetPaneContent", what i am doing wrong?
Thanks
As I mentioned in my previous post the GetPaneContent() method is only for example purposes. You will have to write its implementation, so that it can fit your requirements.
All the best,
Konstantina
the Telerik team

By the way, how can i use the serialization tag in code behind(c#)?
I have tried this way, but does not work.
String titulo = "tst";
RadPane pane = new RadPane();
pane.Name = titulo;
Telerik.Windows.Controls.RadDocking.SetSerializationTag(pane, titulo);
Thanks again.

I spent more than 2 days to find an issue to resolve the content and header lost.
Now my problem is when I have a binding that change the header. The header conserve the value of the binding until the SaveLayout moment, and after that, the binding is lost.
I'm really disappointed because I think there is no real good solution except if you update your RadDocking component.
Do you think that the save/load problem will be resolved soon?
Thanks in advance.
Straight to the questions:
- Using RadDocking.SetSerializationTag(radPane, "yourString"); is a proper way to set serialization tag in code behind
- As you correctly noticed the Docking control saves the Header text instead of a Binding expression. This implementation is by design. Sorry for any inconvenience caused. You could hook up to the ElementLoaded event of the RadDocking control and to put your binding expression, just like Konstantina suggested you.
Attached you can find a sample that illustrates this scenario. I hope this helps! I will be glad to assist you further.
George
the Telerik team

Would I also need something along these lines if I am using RadDocking with Prism? Currently I can save the layout of RadDocking, but when I load the layout Prism can not find the regions associated with the RadPaneGroups. If I comment out the LoadLayout everything works as expected except of course the layout doesn't get loaded. Below is some code that will hopefully clarify what I am talking about.
Any direction you could offer here would be appreciated.
Load Layout Method
private
void
LoadLayout()
{
byte
[] bytes = System.Text.Encoding.ASCII.GetBytes(Infrastructure.Properties.Settings.Default.DockLayout);
MemoryStream ms =
new
MemoryStream();
ms.Write(bytes, 0, bytes.Length);
this
.radDock.LoadLayout(ms);
ms.Close();
}
RadDocking Xaml
<
telerikDocking:RadDocking
telerik:StyleManager.Theme
=
"{Binding Source={StaticResource settings}, Path=Default.CurrentTheme}"
AllowUnsafeMode
=
"True"
diag:PresentationTraceSources.TraceLevel
=
"High"
x:Name
=
"radDock"
>
<
telerikDocking:RadSplitContainer
Name
=
"LeftContainer"
InitialPosition
=
"DockedLeft"
telerik:StyleManager.Theme
=
"{Binding Source={StaticResource settings}, Path=Default.CurrentTheme}"
>
<
telerikDocking:RadPaneGroup
x:Name
=
"groupLeftRegion"
cal:RegionManager.RegionName
=
"{x:Static i:RegionNames.LeftRegion}"
diag:PresentationTraceSources.TraceLevel
=
"High"
telerik:StyleManager.Theme
=
"{Binding Source={StaticResource settings}, Path=Default.CurrentTheme}"
PropagateItemDataContextToContent
=
"False"
/>
</
telerikDocking:RadSplitContainer
>
<
telerikDocking:RadSplitContainer
Name
=
"BottomContainer"
InitialPosition
=
"DockedBottom"
telerik:StyleManager.Theme
=
"{Binding Source={StaticResource settings}, Path=Default.CurrentTheme}"
>
<
telerikDocking:RadPaneGroup
x:Name
=
"groupBottomRegion"
cal:RegionManager.RegionName
=
"{x:Static i:RegionNames.BottomRegion}"
diag:PresentationTraceSources.TraceLevel
=
"High"
telerik:StyleManager.Theme
=
"{Binding Source={StaticResource settings}, Path=Default.CurrentTheme}"
PropagateItemDataContextToContent
=
"False"
/>
</
telerikDocking:RadSplitContainer
>
<
telerikDocking:RadDocking.DocumentHost
>
<
telerikDocking:RadSplitContainer
Name
=
"ContentContainer"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
telerik:StyleManager.Theme
=
"{Binding Source={StaticResource settings}, Path=Default.CurrentTheme}"
>
<
telerikDocking:RadPaneGroup
x:Name
=
"groupContentRegion"
cal:RegionManager.RegionName
=
"{x:Static i:RegionNames.ContentRegion}"
diag:PresentationTraceSources.TraceLevel
=
"High"
telerik:StyleManager.Theme
=
"{Binding Source={StaticResource settings}, Path=Default.CurrentTheme}"
PropagateItemDataContextToContent
=
"False"
/>
</
telerikDocking:RadSplitContainer
>
</
telerikDocking:RadDocking.DocumentHost
>
</
telerikDocking:RadDocking
>
Please refer to our forum thread where you can find interesting notes regarding the usage of Prism and RadDocking. Also, you could find more information in Miroslav Nedyalkov's blog - http://blogs.telerik.com/miroslavnedyalkov/posts/09-08-31/using_the_raddocking_control_with_prism.aspx
I hope this helps! Please do not hesitate to contact us if you require any further information. I will be glad to assist you further.
George
the Telerik team

Thank you for your response, but I have to say I was a little disappointed by the answer. I almost always check the forums before posting and Miroslav and I have had correspondence several times about MVVM Prism and Telerik controls so I had indeed read the blog you suggested. Not that I don't appreciate the links, but in the end I was really looking for a more thoughtful answer to my question.
I guess I will assemble a small sample application and just put a support ticket in. I would however like to suggest that you guys look at doing some more in depth blogs/KB articles on MVVM and Prism, especially when it comes to RadDocking as it seems to be the most finicky control when it comes to this type of implementation.
Thanks again George!
I would suggest you to add a serialization tag to all RadDocking elements as well. (RadPaneGroups, RadSplitContainers, RadPanes). Please, try it and let me know if it helps.
Also, pay attention to that when you drag and place a group in the docking layout, you actually move only the panes, the group actually stays at the same place where it was (but it has no panes).
Looking forward to your reply. I will be glad to assist you further.
George
the Telerik team

The documentation on this seems to imply that what you suggest isn't necessary. It says, "When you load the layout, all the elements that are not marked with SerializationTag property are removed and new components are created instead. That is the reason why you should mark your panes with the SerializationTag attribute." Which led me to believe that the Panes were the only items needing the attribute. You may want to revise the documentation.
source: http://docs.telerik.com/devtools/silverlight/controls/raddocking/features/save-load-layout.html#load-layout
Thanks for your feedback - we will definitely consider the suggestion.
Regards,
Kalin
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

I am using MVVM and I have a fairly simple global style which adds an icon to pane header, which looks like this:
<
DataTemplate
x:Key
=
"HeaderTemplate"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Image
Margin
=
"0,0,3,0"
Source
=
"{Binding Screen.IconSource}"
Width
=
"16"
Height
=
"16"
VerticalAlignment
=
"Center"
/>
<
TextBlock
Text
=
"{Binding Screen.Title}"
x:Name
=
"text"
VerticalAlignment
=
"Center"
/>
</
StackPanel
>
</
DataTemplate
>
<
Style
TargetType
=
"{x:Type Controls:RadPane}"
>
<
Setter
Property
=
"HeaderTemplate"
Value
=
"{StaticResource HeaderTemplate}"
/>
<
Setter
Property
=
"TitleTemplate"
Value
=
"{StaticResource HeaderTemplate}"
/>
</
Style
>
After I load the layout - all the bindings set by this style are broken (at least thats what VS Output window says) and I see empty headers everywhere. How am I supposed to repair this style after the layout is loaded? I could recreate simple bindings in ElementLoaded event, as your example suggests. But what should I do with styles and templates, especially with complex ones?
We are not aware of such an issue. Can you share some more details about the exact scenario? How do you create the Panes and how do you set their DataContext? Also what version of the controls are you using? Please provide more sample code reproducing the issue.
I'm looking forward to hearing from you.
Regards,
Kalin
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.