Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1255
XamDockManager.Save(and Load)Layout sample
posted

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.

Parents
  • 54937
    Offline posted

    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.

Reply Children