Serialization and Deserialization of Programmatically Added Document Windows

Docking/MDI for WPF Forum

Posted 11 years ago by Harry Nystrom
Version: 12.2.0570
Avatar

I have a situation where some of the document windows in a particular docksite control are specified in XAML and others are added programmatically.  Serialization and deserialization works fine for the ones defined in XAML.  However the ones added programmatically seem to be ignored by the deserialization process.  Is there a way to ensure that they are included?

Comments (8)

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

Hi Harry,

It shouldn't matter how the docking windows are defined.  But note that the available ones are matched up by Name, as described in the "Layout Serialization" documentation topic.  So if you didn't define a Name on your programmatically-created ones that match layout data, then that could be the problem.


Actipro Software Support

Posted 11 years ago by Harry Nystrom
Avatar

I do provide a name for each document window added - 'DW' plus a Guid that I convert to a string.  A different number of programmatically-created window with different content might exist each time I do through the serialization/deserialization cycle (shut down the application and restart it).  I really don't understand how I would do the matching?  Any ideas?

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

Hi Harry,

Could we take a step back and have you explain a bit more about what you are trying to accomplish?  Perhaps give a brief summary of your application design, such as what the tool and document windows are, what you are trying to save/load from the layout data, etc.


Actipro Software Support

Posted 11 years ago by Harry Nystrom
Avatar

In the application I am working on, I am trying to create a DockSite that has five "fixed" DocumentWindow objects that are described in XAML, and a variable number of programmatically-added DocumentWindow objects.  The user wants to be able to request a set of "report objects" to be displayed from a modal dialog, add these within DocumentWindow objects to the total collection for the DockSite, and then serialize these, so that the next time the application is run, these programmatically-created DocumentWindow objects will be included in the set initially displayed within the DockSite.

Answer - Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Harry, 

Please check out the "Layout Serialization" documentation topic.  It has some info on auto-creation that is probably what you want.  Basically the layout load will raise an event as each document window is being serialized.  Then you can see if the document window with that name has already been registered with the DockSite or not yet.  If not, you can add it.  That would allow your pre-configured and dynamically-created ones to both be restored.


Actipro Software Support

Posted 11 years ago by Harry Nystrom
Avatar

I had already read the documentation.  The programmatically-added DocumentWindows containing the user-selected reports DO get included when serialization is performed.  However, they are "ignored" when deserialization is performed the next time the application is run.  The only reason I can determine for this is that there is no "pre-coded" XAML for them in the DockSite definition.  I don't know if that is really true or not.  So ... how should I go about deserializing the programmatically-added DocumentWindows?  Also, on the serialization side, is there a way of including the object detail for the children of the programmatically-added DocumentWindows?

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

Hi Harry,

Well what I was referring to was the section on "Auto Creation" in that topic.  That seems like it's what you want to do since your layout will have references to document window that the DockSite doesn't yet know about.

Also if you want to store more data in the serialization than what it does now, you can do so.  The NavigationBarLayout QuickStart (in the Navigation product family) shows this concept.  It uses a serialization mechanism just like Docking's.


Actipro Software Support

Posted 11 years ago by Harry Nystrom
Avatar

I was able to figure out a way of doing what I need to do with the "hints" you gave in your last post.  Thanks.

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.