Programmatically build up RadDock from app.config file

2 posts, 0 answers
  1. Matthew
    Matthew avatar
    3 posts
    Member since:
    Jul 2011

    Posted 01 Aug 2011 Link to this post

    I am looking into replacing our current docking control with the RadDock control. What our current dock control allows us to do is have a fairly simple xml configuration to allow dynamic layouts. We have a bunch of controls that can be dynamically loaded, the customer can control which controls are loaded and the layout (dock position, auto hide, and so on).

    Example plugin config
    <plugin load="true"
            type="AssemblyName, ClassName"

    This control is a child (controlled by CurrentMode tag) and will be display in the bottom portion of it's parent (controlled by the CurrentDock tag). If the CurrentDock is changed to Fill then it will the same space as it's parent and become a TabControl.

    My question is, does the RadDock have the ability to allow me to dynamically build up this layout from a simple configuration? I would like to just add the RadDock control to the form and have it built up from the config file, the customer would also need to be able to change the layout.

    This is the code that will load all the controls in the app.config file where plugin load = true. This seems to give me the parent / child tab layout I am looking for, but it seems like it's not the "right" way to do it. For instance, if I want two controls docked Left within the RadDock but tabbed, would it be better to create a ToolWindow and add those two controls to that, or pass in the target control (parent) while calling DockControl?

    foreach (SnapInBase plugin in BuildPluginHierarchy(this.plugins))
            if (plugin.MetaData.ContainsKey("Form") && plugin.MetaData["Form"] != null)
                XmlNode n = plugin.MetaData["Form"];
                plugin.Dock = DockStyle.Fill;
                DockPosition position = ParseXmlNode<DockPosition>(n, "DockPosition");
                DockType dockType = ParseXmlNode<DockType>(n, "DockType");
                Guid guid = ParseXmlNode<Guid>(n, "Guid");
                int width = ParseXmlNode<Int32>(n, "Width", plugin.Width);
                int height = ParseXmlNode<Int32>(n, "Height", plugin.Height);
                bool isAutoHide = ParseXmlNode<Boolean>(n, "IsAutoHide");
                Guid parentGuid = ParseXmlNode<Guid>(n, "ParentGuid");
                int screen = ParseXmlNode<Int32>(n, "Screen", 1);
                if (screen == 1)
                    if (parentGuid != Guid.Empty)
                        HostWindow parent;
                        if (this.controlCache.TryGetValue(parentGuid, out parent) == true)
                            HostWindow window = null;
                            window = this.radDock1.DockControl(plugin, parent, position, dockType);
                            if (isAutoHide == true)
                            this.controlCache.Add(guid, window);
                        var window = this.radDock1.DockControl(plugin, position, dockType);
                        if (isAutoHide == true)
                        this.controlCache.Add(guid, window);
                logger.Error(string.Format("No form metadata for {0}", plugin.Name));
        catch (Exception ex)

    What I am hoping for is to find out is if there is a better way to do what I'm trying to do. I will provide the customer a default layout, and they can change it how they see fit.

  2. Julian Benkov
    Julian Benkov avatar
    1135 posts

    Posted 03 Aug 2011 Link to this post

    Hi Matthew,

    You can use RadDock Save/Load Layout feature to support this functionality. The RadDock control can save/load layout using file, Stream, TextWriter/TextReader. More information you can find in our online documentation.

    I hope this information is useful. Let me know if you need further assistance.

    Julian Benkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top