Telerik blogs

    Many times in an application you want your user to have the ability to set preferences.  This extends to a variety of settings, but what about the interface itself?  If you are using the DockingManager you can give the user the ability to modify the layout of existing DockPanels and store it for them.  Why would you want to let the user change the layout?  Every person is different and most people enjoy having the option of customizing an application.  This can be as simple as having a tool window on the right of the screen instead of the left.  Whatever the reason, by allowing the user to modify the layout of an application and see that layout in the future, most people will appreciate the application a little more.  Well, maybe not, but they will probably be happy they can make the change.

    If you have the DockingManager control in your application and would like to store the users layout it is extremely simple.  The DockingManager uses XML to build the dockable containers displayed.  This XML is available to you via the LayoutTree property of the control.  If you allow the user to modify the layout at runtime, you can persist the layout XML to your database and apply it when the user starts your application in the future.  Simply retrieve the XML from your database and set the LayoutTree property of the DockingManager.  If you prefer to store this type of information in a file or don't have time to add the code to save it to the database, you are still covered.  No need to write the string to a file yourself, the DockingManager control provides a SaveXML function which takes a filepath as an argument.  This will save the layout XML to the file you specify.  Now that you have the layout saved to a file, you can call the LoadXML function and pass it the filename.  In just a few simple steps your users can rearrange all day long.  I recommend you always store a default setting for the user to revert back to the initial layout.  This protects you against the instance where a user is a novice and has difficulty with the layout.


About the Author

Nikolay Diyanov

Diyanov is the Product Manager of the Native Mobile UI division at Progress. Delivering outstanding solutions that make developers' lives easier is his passion and the biggest reward in his work. In his spare time, Nikolay enjoys travelling around the world, hiking, sun-bathing and kite-surfing.

Find him on Twitter @n_diyanov or on LinkedIn.

Comments

Comments are disabled in preview mode.