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

3 posts, 1 answers
  1. YBOT
    YBOT avatar
    8 posts
    Member since:
    Jul 2017

    Posted 06 Nov 2019 Link to this post

    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. Answer
    Kalin
    Admin
    Kalin avatar
    1352 posts

    Posted 11 Nov 2019 Link to this post

    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.
  3. YBOT
    YBOT avatar
    8 posts
    Member since:
    Jul 2017

    Posted 12 Nov 2019 in reply to Kalin Link to this post

    I tried R3 2019 SP and it's solved my issue. Thanks.
Back to Top