Error on LoadLayout

2 posts, 0 answers
  1. Chris
    Chris avatar
    7 posts
    Member since:
    Jun 2007

    Posted 22 Jul 2013 Link to this post

    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.
  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 23 Jul 2013 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top