In the Feature Browser, the sample for SaveLayout and LoadLayout works for panes that are created statically in the xaml. Do you have an example of Save(and Load)Layout when the user has dynamically loaded documents and moved them around?
If no example, do you have any advice to help me extend these methods to perhaps save the Type of the class contained in the SplitPane, then load that Type before setting the docking position of the contentpane? After working with these methods over the weekend, I see that the xml generated by the SaveLayout method identifies the contentpane by its Name. But the LoadLayout method does not actually create the instance of this object if it does not exist in the xaml. That's what I need to do.
Thanks in advance for any guidance you can provide.
During the LoadLayout, if a ContentPane with a Name that is not currently part of the XamDockManager is encountered, the InitializePaneContent event is raised. The event argument has a new ContentPane whose Name and SerializationId have been initialized with the information stored in the layout. You would then handle this event and use the information you put in the SerializationId before the layout was saved to determine what type of element to construct, create an instance of that and set the Content of the e.NewPane (as well as any other properties on the pane - e.g. Header). If the e.NewPane.Content is not set, then the pane is not included in the layout being loaded. So you need to make sure that you set the SerializationId to a string that contains the information you need to know what type of element to create.
While handling InitializePaneContent, how should one decide whether this new ContentPane should be part of DocumentConentHost or not?
WHen handling the event you just need to initialize the e.Pane or create a ContentPane and set the e.Pane property. You don't need to put it into the dockmanager. It will put it where it belongs based on the info in the layout file you are loading.