Tabbed MDI Document Layout Deserialization Help

Docking/MDI for WPF Forum

Posted 3 years ago by John Reilly
Version: 20.1.0

I have a tabbed MDI application, where the dock site only contains document windows, which are my own class derived from DocumentWindow. Following the help file, I have set a unique SerializationId and set SerializationBehavior = All.

When I look at the serialized XML, it is reasonable.

When I deserialize, it doesn't work. First I create all the documents and add them to the site's DocumentWindows collection. This is done correctly because if I comment out the layout deserialization, I can see the tabbed windows. But when I call the deserializer LoadFromString(), all my windows get closed.

If I reverse the order and set both lazy load and CanKeepExistingDocumentWindowsOpen to true, my document windows are open but the layout is not applied.

I really need this to work.



Comments (2)

Answer - Posted 3 years ago by John Reilly

I got something to work.

The documentation leads me to believe that my original deserializing code would work: I pre-create the document windows, adding them to the dockSite.DocumentWindows collection, then create a serializer with both lazy load and CanKeepExistingDocumentWindowsOpen set true, and finally call LoadFromString() on the serializer.

That doesn't work.

What does work is to create a (de)serializer and add an event handler for DockingWindowDeserializing. In that handler, I create the document window for the given SerializationId and assign the document window to the event argument's Window property, and then set event argument's Handled property to true.

The "Layout Serialization" documentation needs some work.

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA

Hi John,

It's hard to say what's happening in your scenario without something to debug, but in general if you have the same serialization IDs in DocumentWindows that are already loaded as that serialization IDs in the layout XML, then it should find and use those instance properly.  You shouldn't have to jump through any hoops to make it work.

If you can reproduce this scenario in a new simple sample project and send that to our support address, we could take a look to see where it's going wrong.  Please reference this thread in your email and exclude the bin/obj folders from the .zip so it doesn't get spam blocked.  Thanks!

Actipro Software Support

The latest build of this product (v24.1.2) was released 28 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.