Docksite Serialization - multiple instances of particular view

Docking/MDI for WPF Forum

Posted 5 years ago by Sebastian Baumgartner
Version: 18.1.0675
Platform: .NET 4.6
Environment: Windows 10 (64-bit)


In the application, the user can open mutliple instances of a specific type (VncView) which contains a VNC viewer and connects to a VNC Server if the ViewModels "OnNavigatedTo" is executed. In the OnNavigatedTo handler, the views name is changed so I have the information to which IP adress it connects.
When the windows have been arranged, the user can click on "Save layout" and the DockSiteLayoutSerializer SaveToString method is called. 
The problem here is, that the serializer does not write the changed view name into the file but keeps it original value. So instead of the value "VNC_127_0_0_1" I have "VNCViewer" in the Name attribute of the  serialized window and no longer know to which VNC server instance I should connect.

In the previous version "15.1.624.0" I set the name of the view in the IDockingWindowInitializer.Initialize(DockingWindow dockingWindow, object item) method which is not available anymore and the view's name was serialized correctly into the file. When the layout was loaded, I checked the file content for "VNC" entries. Because of the name i knew which RequestNavigate Command I had to call so that the separate instances of the VNCViewer class were loaded into the docking window.

After my check of the layout file, the layout was loaded and the docking windows were arranged correctly. 

When and what do I have to change, so that the instance's name is correctly serialized into the layout file? I have tried to change the name of the instance in the ViewModels OnNavigatedTo Method, but the change has no affect to what is written into the serialized file. 

Thank you for your help

Comments (1)

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

Hi Sebastian,

Instead of setting the DockingWindow.Name property, what about using the SerializationId property?  The SerializationId property is a better one to use in general because it doesn't have the "identifier" naming restrictions on it like Name does.  It also is easily bindable.

If SerializationId is specified, the serializer will use that instead of Name, and will fall back to Name otherwise.  This is described a bit in the "Layout Serialization" documentation topic.

Let us know if that helps.

Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.