This is a migrated thread and some comments may be shown as answers.

Reset dock layout to designer settings: Best practice?

1 Answer 320 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Raoul
Top achievements
Rank 1
Raoul asked on 31 May 2012, 12:42 PM
Hi,

In an MDI environment with (30+) childforms I'd like to be able to reset each child form to the standaard (designer) layout when the end user messed up by eg. hiding tool windows etc.

First of all, saving 60+ XML files (user dock + default dock) to each end user profile is not my preferred option. I saved the default, and the user dock XML to the registry for now, but I'm considering using a table in the database.
However saving/restoring the defaults is a potential bug, because when the app is updated and a form was changed by adding or deleting a tool/document window the "dock.LoadFromXml(dockSettings)" fails, since the xml in the registry reflects the 'old' pre-update form.

So 2 questions:
- Is there a way to reset the dock layout, without the LoadFromXml? That way I would not need to 'remember' the default designer settings. If not, what is the best practice to reset the updated forms in my updated app to the default?
- saving to a table, I would only need to save these 3 columns, or do I mis something?
   - form name
   - Dock XML info
   - UserId for particular settings (or eg. Guid.Empty for the default)

Kind regards,
Raoul

1 Answer, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 05 Jun 2012, 09:52 AM
Hello Raoul,

1) You can reset the RadDock and clear all windows before the LoadFromXml operation using this API:

this.radDock.RemoveAllWindows(DockWindowCloseAction.CloseAndDispose);
this.radDock.CleanUp();

2) The solution with the table that contains the Form, DockXmlInfo, UserID is suitable for your application if every Form object contains RadDock.

I hope this helps. Let me know if you need further assistance.

Greetings,
Julian Benkov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
Dock
Asked by
Raoul
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Share this question
or