Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2945
Error restoring layout
posted

If I create panes on the fly, then save the layout to file, when I then restart the application and restore the layout, LoadFromXML throws a NotSupportedException with error "Collection is read only."

System.NotSupportedException occurred
Message=Collection is read only.
Source=System.Windows.Forms
StackTrace:
at System.Windows.Forms.SplitContainer.SplitContainerTypedControlCollection.Remove(Control value)
at System.Windows.Forms.Control.set_ParentInternal(Control value)
at System.Windows.Forms.Control.set_Parent(Control value)
at Infragistics.Win.UltraWinDock.UltraDockManager.ReparentControl(Control control, Control newParent)
at Infragistics.Win.UltraWinDock.DockableControlPane.HookContainedControl()
at Infragistics.Win.UltraWinDock.DockableControlPane.set_Container(DockableWindow value)
at Infragistics.Win.UltraWinDock.UltraDockManager.GetPaneContainer(DockableControlPane pane)
at Infragistics.Win.UltraWinDock.UltraDockManager.CreatePaneContainer(DockableControlPane pane, WindowDockingArea dockingArea)
at Infragistics.Win.UltraWinDock.UltraDockManager.SetupPaneControl(DockablePaneBase pane)
at Infragistics.Win.UltraWinDock.UltraDockManager.SetupPaneControl(DockablePaneBase pane)
at Infragistics.Win.UltraWinDock.UltraDockManager.PaneAdded(DockablePaneBase pane)
at Infragistics.Win.UltraWinDock.DockAreasCollection.InitControl(UltraDockManager manager)
at Infragistics.Win.UltraWinDock.UltraDockManager.InitializePaneControls()
at Infragistics.Win.UltraWinDock.UltraDockManager.InitializeComponent()
at Infragistics.Win.UltraWinDock.UltraDockManager.InitializeFrom(UltraDockManager source)
at Infragistics.Win.UltraWinDock.UltraDockManager.Load(Stream stream, Boolean xml)
at Infragistics.Win.UltraWinDock.UltraDockManager.LoadFromXML(String filename)
at myApp.RestoreLayout() in myApp.vb:line 1483
InnerException:

The form layout is then corrupt (e.g. I lose my UltraToolbar, and controls that were docked as Fill are now not resizing with the form)

What is the best way to recover from this (so it just gives me the layout I would have had without trying to load it), and why can it not just ignore restoring layout for any controls it can't find?  I tried saving the current layout before loading from file, so I could load this back, but this does not seem to work. :(

Thanks,
Campbell 

Parents
  • 71886
    Offline posted

    Hello Campbell,

    As I understand - you have dockmanager, toolbarsmanager and docked controls. You save your layout of the dockmanager, remove some controls and load the layout. If this is correct, I tried it and it always works fine for me, so I attached my sample to this post for you. Please review it and feel free to let me know if I misunderstood you or if you have any other questions.

    SaveLoadXMLDock.zip
Reply Children