When you set the BaseView.FloatingDocumentContainer property to DocumentsHost, floating documents are hosted within a container to which other documents can be docked. Thus, this floating container contains its own DocumentManager. As a result, if you wish to save layouts of floating documents residing within such a floating container, you need to access their own DocumentManagers. You can do this in the BaseView.RegisterDocumentsHostWindow event handler. Finally, obtain a corresponding View via the DocumentManager.View property, and use its BaseView.SaveLayoutToXml and BaseView.RestoreLayoutFromXml or BaseView.SaveLayoutToStream and BaseView.RestoreLayoutFromStream methods.
This example illustrates how to collect all the Views associated with floating containers, and save and restore their layouts. In short, we create a list of Views where we add a new View in the BaseView.RegisterDocumentsHostWindow event handler. We also delete a View after its floating container is destroyed in the BaseView.UnregisterDocumentsHostWindow event handler.
Question Comments
Added By: Matthias Weidmann at: 1/29/2016 1:02:07 AM
Hello and thanks for the example.
I have noticed that closed floating windows won't be opened during restore.
Do I have to disable the OnUnregisterDocumentsHostWindow event and recreate the closed floating windows within the OnRestoreLayout function? Or ist there an easier way of restoring closed floating windows?
Best regards,
Matthias
Hello,
To process your recent post more efficiently, I created a separate ticket on your behalf: T340260: A closed host window is not restored. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.