DockSiteLayoutSerializer.LoadFromString feature request

Docking/MDI for WPF Forum

Posted 14 years ago by Markus Springweiler
Version: 10.1.0522
Avatar
Hello,

would it be possible to (optionally) split the deserialization (loading) into 2 steps:
* everything but floating windows
* only floating windows

This way I could use the first step just before the MainWindow is shown at all and the second step just after it has been shown.

Currently deserialization before showing the MainWindow only works as long as the user has not floated any of the ToolWindows, but crashes when he did (throwing an exception saying that ownership of windows can only attached to already shown windows).

And the re-design of the MainWindow on startup does not only look ugly, it also costs a lot of CPU.

Comments (4)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Markus,

We are not aware of any crashes with the Docking & MDI for WPF product. Could you please put together a small sample project that reproduces the issue and email it over to our support address? Be sure to remove any executable files from the zip archive. Once we have that we can see what the problem is.

Is your request for a two stage load a result of trying to work around the crash? If not, we could certainly mark that down on our TODO list for when we revisit the serialization code.


Actipro Software Support

Posted 14 years ago by Markus Springweiler
Avatar
I did not find any clear advice inside the docs when the LoadFromString should be called, but putting it directly inside the constructor (after InitializeComponent()) worked well for some time -- exactly the time when there were floating windows at the last shutdown of the application.

Then it crashes on next load:
System.InvalidOperationException occurred
  Message=Cannot set Owner property to a Window that has not been shown previously.
  Source=PresentationFramework
  StackTrace:
       at System.Windows.Window.set_Owner(Window value)
       at ActiproSoftware.Windows.Controls.Docking.Primitives.RaftingWindow..ctor(RaftingHost container)
       at ActiproSoftware.Windows.Controls.Docking.DockSite.b(RaftingHost A_0)
       at ActiproSoftware.Windows.Controls.Docking.DockSite.CreateRaftingWindow(RaftingHost raftingHost)
       at ActiproSoftware.Windows.Controls.Docking.DockSite.a(DependencyObject A_0, Nullable`1 A_1, Nullable`1 A_2, FloatSizingBehavior A_3, Boolean A_4)
       at ActiproSoftware.Windows.Controls.Docking.DockSite.b(DependencyObject A_0, Nullable`1 A_1, Nullable`1 A_2, FloatSizingBehavior A_3, Boolean A_4)
       at ActiproSoftware.Windows.Controls.Docking.DockSite.b(DependencyObject A_0, Nullable`1 A_1, Boolean A_2)
       at ActiproSoftware.Windows.Controls.Docking.Serialization.DockSiteLayoutSerializer.a(DockSite A_0, XmlRaftingHost A_1)
       at ActiproSoftware.Windows.Controls.Docking.Serialization.DockSiteLayoutSerializer.a(DockSite A_0, XmlDockSiteLayout A_1)
       at ActiproSoftware.Windows.Controls.Docking.Serialization.DockSiteLayoutSerializer.ApplyTo(DockSite obj)
       at ActiproSoftware.Windows.Serialization.XmlSerializerBase`2.LoadFromString(String xml, TObj obj)
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Markus,

Thanks, we were able to reproduce the issue in our Layout Persistence QuickStart by moving the LoadLayout() call to the window constructor like you described. We've added a workaround for the next maintenance release that fixes this issue.


Actipro Software Support

Posted 14 years ago by Markus Springweiler
Avatar
Thanx.

While this seems to work for simple scenarios I now have a problem where the layout of an nested docksite only gets deserialized when the outer container is already floated.

I'll try to setup a test project as soon as I find some spare time for this -- currently calling LoadFromString from within WindowLoaded-Event again fixes the problem.
The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.