When to load docking layout

2 posts, 0 answers
  1. Chris
    Chris avatar
    23 posts
    Member since:
    May 2011

    Posted 14 Sep 2012 Link to this post

    I need to save docking layout into a file when the application is closing and retrieve the layout at start-up.  I tried to learn it from the Docking Serialization example, my application calls OnSave on Window_Closed event and copy the stream into a file.  Since most of modules in the application are discovered by Prism and added into the RadDocking via Prism's RegionManager at start-up, so I am not sure when should I call OnLoad function to load the layout from the file.  Could you please help.  .

    Another question: what different between Isolated Storage vs Save in a Stream?

  2. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 19 Sep 2012 Link to this post

    Hi Chris,

    Well since you're using PRISM you need to make sure that all modules have loaded in the RadDocking before saving or loading their properties. For example you can get a reference of the IModuleManager in your Shell main view. Then you will be able to attach a handler to the IModuleManager.LoadModuleCompleted event and load the persisted settings after all modules have successfully loaded.

    When you're uring the PersistenceFramework to persist the UI of your application, you basically get two options:
    • save the settings in a stream object  - in this case, you'll need to save the stream object so that it can be used at any time to load the persisted settings. This approach is usually used when you'd like to keep the persisted settings in a stream in a database.
    • save the settings in a file in the isolated storage - the isolated storage is a data storage mechanism that provides isolation and safety by defining standardized ways of associating code with saved data. And the PersistenceFramework allows you to apply a StorageId on the UIElements that have to be persisted and automatically creates a file in the isolated storage to save the settings of these UIElements. When you call the SaveToStorage() method, the properties of all objects marked with a StorageId will be persisted in different files in the isolated storage and when you call LoadFromStorage() the framework will find the appropriate files for the objects and load the saved settings accordingly.

    I hope this information will help, still let us know if we can further assist you.

    Tina Stancheva
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

Back to Top