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

LoadLayout error: System.ArgumentOutOfRangeException: 'Specified argument was out of the range of valid values. Parameter name: elementTypeName

2 Answers 102 Views
Docking
This is a migrated thread and some comments may be shown as answers.
YBOT
Top achievements
Rank 1
Veteran
YBOT asked on 06 Nov 2019, 11:31 AM

I have an issue when loading the layout on Raddock. I'm trying to cancel a view loading if the users access has been revoked. However when I do LayoutSerializationCustomLoadingEventArgs.Cancel = true and return from OnCustomElementLoading I get the following error.

System.ArgumentOutOfRangeException
  HResult=0x80131502
  Message=Specified argument was out of the range of valid values.
Parameter name: elementTypeName
  Source=Telerik.Windows.Controls.Docking
  StackTrace:
   at Telerik.Windows.Controls.Docking.DefaultDockingLayoutFactory.NotifyCustomElementLoading(String elementTypeName, String serializationTag, Dictionary`2 attributes)
   at Telerik.Windows.Controls.Docking.DefaultDockingLayoutFactory.ReadPaneXml(XmlReader reader)
   at Telerik.Windows.Controls.Docking.DefaultDockingLayoutFactory.LoadPaneGroup(LoadingParentElementArgs args)
   at Telerik.Windows.Controls.Docking.DefaultDockingLayoutFactory.LoadSplitContainer(LoadingParentElementArgs args)
   at Telerik.Windows.Controls.Docking.DefaultDockingLayoutFactory.LoadDocking(LoadingParentElementArgs args)
   at Telerik.Windows.Controls.Docking.DefaultDockingLayoutFactory.LoadLayout(XmlReader reader)
   at Telerik.Windows.Controls.RadDocking.LoadLayout(Stream source, Boolean raiseEventsIfNoSerializationTag)
   at MyApp.LoadLayout(LoadLayoutEventParameters loadLayoutEventParameters) in.. 

Here is the code:

 

public void LoadLayout(LoadLayoutEventParameters loadLayoutEventParameters)
{
     using (FileStream layoutFile = new FileStream(Path.Combine(this.configPath, this.layoutFilename), FileMode.Open))
      {
             radDocking.LoadLayout(layoutFile);
      }
}

 

My views inherit RadPane so I use CustomElementLoading.

this.radDocking.CustomElementLoading += this.MyApp.OnCustomElementLoading;

 

 

public void OnCustomElementLoading(object sender, Telerik.Windows.Controls.LayoutSerializationCustomLoadingEventArgs e)
{
    if (!userCanAccess)
    {
          e.Cancel = true;
          return;
    }
    e.SetAffectedElement(MyAppView);
 
}

 

Here is my xaml

<telerik:RadDocking Grid.Row="2" x:Name="radDocking"
                            BorderThickness="0"
                            HasDocumentHost="False">
 
            <telerik:RadDocking.DockingPanesFactory>
                <docking:ShellDockingPanesFactory />
            </telerik:RadDocking.DockingPanesFactory>
 
            <telerik:RadDocking.GeneratedItemsFactory>
                <docking:CustomDefaultGeneratedItemsFactory />
            </telerik:RadDocking.GeneratedItemsFactory>
 
            <telerik:RadSplitContainer Orientation="Vertical" InitialPosition="DockedLeft">
                <telerik:RadPaneGroup HorizontalAlignment="Left"  x:Name="leftGroup" telerik:RadDocking.SerializationTag="leftGroup" />
            </telerik:RadSplitContainer>
            <telerik:RadSplitContainer InitialPosition="DockedRight" >
                <telerik:RadPaneGroup HorizontalAlignment="Right" x:Name="rightGroup" telerik:RadDocking.SerializationTag="rightGroup"/>
            </telerik:RadSplitContainer>
            <telerik:RadSplitContainer InitialPosition="DockedBottom" >
                <telerik:RadPaneGroup x:Name="bottomGroup" telerik:RadDocking.SerializationTag="bottomGroup"/>
            </telerik:RadSplitContainer>
            <telerik:RadSplitContainer InitialPosition="DockedTop" >
                <telerik:RadPaneGroup x:Name="topGroup" telerik:RadDocking.SerializationTag="topGroup"/>
            </telerik:RadSplitContainer>
            <telerik:RadSplitContainer InitialPosition="FloatingOnly" >
                <telerik:RadPaneGroup x:Name="floatingOnlyGroup" telerik:RadDocking.SerializationTag="floatingOnlyGroup"/>
            </telerik:RadSplitContainer>
            <telerik:RadSplitContainer InitialPosition="FloatingDockable" >
                <telerik:RadPaneGroup x:Name="floatingDockableGroup" telerik:RadDocking.SerializationTag="floatingDockableGroup"/>
            </telerik:RadSplitContainer>
        </telerik:RadDocking>

 

How can I control which views are loaded from the saved layout at runtime? I think it would get a bit messy if I start parsing the saved layout file and removing views. I usually save the layout when the app closes, this will remove the views the user can no longer access because I'm hoping they won't open in the first place if the access is revoked.

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Kalin
Telerik team
answered on 11 Nov 2019, 11:21 AM

Hello Toby,

 

Thank you for contacting us.

 

The described issue is already fixed in the latest R3 2019 SP - please give it a try. Meanwhile in order to workaround it you could use the suggested approach here.

 

Please let me know if this will allow you to achieve the desired scenario.

 

Regards,
Kalin
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
YBOT
Top achievements
Rank 1
Veteran
answered on 12 Nov 2019, 02:29 PM
I tried R3 2019 SP and it's solved my issue. Thanks.
Tags
Docking
Asked by
YBOT
Top achievements
Rank 1
Veteran
Answers by
Kalin
Telerik team
YBOT
Top achievements
Rank 1
Veteran
Share this question
or