
Hello,
At this time we don't have a document-only serialization option. The only two options right now are All or ToolWindowsOnly. Therefore the closest thing we can get to what you want to do is to load the "All" layout first (which has documents and clears the existing MDI hierarchy as it restores), and then load the "ToolWindowsOnly" one next.
Part of the problem in the sample you sent us is that your layout serializer always had SerializationBehavior = DockSiteSerializationBehavior.All, so your tool windows layout was effectively also clearing the MDI area. You want to change your sample's methods to be more like this:
private void SaveLayoutMenuItem_Click(object sender, RoutedEventArgs e) {
layoutSerializer.SerializationBehavior = DockSiteSerializationBehavior.All;
documentLayoutData = layoutSerializer.SaveToString(dockSite);
layoutSerializer.SerializationBehavior = DockSiteSerializationBehavior.ToolWindowsOnly;
toolLayoutData = layoutSerializer.SaveToString(dockSite);
}
private void LoadLayoutMenuItem_Click(object sender, RoutedEventArgs e) {
if (string.IsNullOrEmpty(documentLayoutData) || string.IsNullOrEmpty(toolLayoutData))
return;
layoutSerializer.CanKeepExistingDocumentWindowsOpen = true;
layoutSerializer.SerializationBehavior = DockSiteSerializationBehavior.All;
layoutSerializer.LoadFromString(documentLayoutData, dockSite);
layoutSerializer.SerializationBehavior = DockSiteSerializationBehavior.ToolWindowsOnly;
layoutSerializer.LoadFromString(toolLayoutData, dockSite);
}
private void DefaultLayoutMenuItem_Click(object sender, RoutedEventArgs e) {
if (string.IsNullOrEmpty(defaultLayoutData))
return;
layoutSerializer.SerializationBehavior = DockSiteSerializationBehavior.All;
layoutSerializer.LoadFromString(defaultLayoutData, dockSite);
}
If you do that, then it will be pretty close to what you want. The only minor issue will be that tool windows that were in the MDI area will end up in the active MDI container instead of where they previously were, since ToolWindowsOnly serialization behavior doesn't restore MDI structure, only the All behavior does.