Reset dock layout to designer settings: Best practice?

2 posts, 0 answers
  1. Raoul
    Raoul avatar
    33 posts
    Member since:
    Apr 2012

    Posted 31 May 2012 Link to this post

    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
  2. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 05 Jun 2012 Link to this post

    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 >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top