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

Error on LoadLayout

1 Answer 96 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 22 Jul 2013, 02:36 PM
I have the following XML generated by the SaveLayout method:

<?xml version="1.0" encoding="utf-8" ?>
- <RadDocking>
- <SplitContainers>
- <RadSplitContainer Dock="DockedLeft" Width="200">
- <Items>
- <RadPaneGroup SelectedIndex="0">
- <Items>
<RadPane IsDockable="True" Header="Left" CanDockInDocumentHost="False" />
</Items>
</RadPaneGroup>
</Items>
</RadSplitContainer>
- <RadSplitContainer Dock="DockedRight" Width="200">
- <Items>
- <RadPaneGroup SelectedIndex="0">
- <Items>
<RadPane IsDockable="True" Header="Right" CanDockInDocumentHost="False" />
</Items>
</RadPaneGroup>
</Items>
</RadSplitContainer>
- <RadMainSplitContainerExt SerializationTag="RadSplitContainer" Dock="DockedLeft">
- <Items>
- <RadPaneGroup SelectedIndex="0">
- <Items>
<RadPaneExt SerializationTag="RadPane" IsDockable="True" Header="Pane" CanUserPin="False" CanDockInDocumentHost="False" />
</Items>
</RadPaneGroup>
- <RadPaneGroup SelectedIndex="0">
- <Items>
<RadPaneExt SerializationTag="RadPane" IsDockable="True" Header="Pane" CanUserPin="False" CanDockInDocumentHost="False" />
</Items>
</RadPaneGroup>
</Items>
</RadMainSplitContainerExt>
</SplitContainers>
</RadDocking>

When I execute the LoadLayout method with this XML, I receive this exception:

Specified argument was out of the range of valid values.
Parameter name: elementTypeName

Any help would be appreciated - thanks.

1 Answer, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 23 Jul 2013, 03:39 PM
Hi Chris,

Thank you for contacting us.

It seems that you have created a custom RadSplitContainer and RadPane (the RadMainSplitContainerExt and RadPaneExt) that have been saved to the layout xml. The Docking control cannot load those custom Pane and SplitContainer correctly as it has no information about them when loading from the xml. In order for the LoadLayout functionality to understand those custom controls correctly you will need to set them in the ElementLoading event of the control by setting the AffectedElement to the correct type. The next code snippet shows how to set the correct type in that event (as we not aware of the your entire project we consider that the two custom controls are of type RadMainSplitContainerExt and RadPaneExt):
<telerik:RadDocking ElementLoading="Docking_ElementLoading">
...
</telerik:RadDocking>

and in the code behind:
private void Docking_ElementLoading(object sender, LayoutSerializationLoadingEventArgs e)
{
    if (e.AffectedElementSerializationTag == "RadSplitContainer")
    {
        e.SetAffectedElement(new RadMainSplitContainerExt());
    }
 
    if (e.AffectedElementSerializationTag == "RadPane")
    {
        e.SetAffectedElement(new RadPaneExt());
    }
}

If you have any other questions feel free to write to us again.

Regards,
Vladi
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
Docking
Asked by
Chris
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Share this question
or