I'm currently working with saving and restoring layout in two windows. The DockSites are linked, and there are some strange artifacts in the current implementation:
In our implementation, we have two collections for DocumentWindows, and the same for ToolWindows. These collections contain ViewModels, and we have followed the example from the sample browser (using the attached behaviors).
We seem to have some slight problems when applying layout, where sometimes windows (document or tool) don't show up when layout is applied. I assume this is because the layout doesn't contain some of these windows, and they are therefore closed. I would like to keep them visible, without having to manipulate the xml string to place the items in the correct location before applying the layout. Other times they show up in both windows for some strange reason (could have been related to InvalidOperationException (enumeration was modified) when applying layout, though I think that was resolved when using Begin/EndUpdate on DeferredObservableCollection).
My next question would be: with two windows and linked docksites, would you recommend using the same DocumentItemsSource and ToolWindowItemsSource for both Docksites, or keep the solution as I have it, and move items between the lists, based on if they can be found in layout for either of the two windows.
Some of the items are usercontrols (there is a good reason behind this, though not a topic for this discussion), and that present a problem with existing parent when binding to the same list, however, I can probably work around that in DockSiteViewModelBehavior if they already have a parent. I don't currently know how I would work around it, but perhaps there is a way.
I'm sorry, but I don't have an example I can provide you with at the moment, but I guess for now I am mainly looking for directions when working with linked docksites.
[Modified 8 years ago]