|
SandDock for Silverlight Documentation Advanced Topics Layout Serialization The state of your entire window layout can be serialized into a string containing XML at any time, by calling the static LayoutSerialization.SaveLayout method. The string returned by this method can then later be passed to the LayoutSerialization.LoadLayout method, at which point all windows are returned to the positions they were in when the first call was made. If you want layout serialization within one application session the above methods are all you need. This would be fine for an application that had two distinct states of operation and needed to switch between them dynamically. For example, Visual Studio has two distinct window layouts: normal and debugging. SandDock identifies individual windows with the attached LayoutSerialization.Guid property. If this has not been specified, a new guid is created. This works within one application session but if you want to persist layout information between the user's visits to your website, you will need to explicitly assign each window its own Guid in this manner. The easiest way to persist layout information between visits to your website is to use isolated storage. We provide simple SaveLayoutToIsolatedStorage and LoadLayoutFromIsolatedStorage methods to assist with this. You should call the former in the Exit event of your application and the latter in the Loaded event of the window in which your SandDock layout resides. If your DockSite has a Name specified, this will form part of the settings key used to save layout information. |