Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
Problem with save/load dock layout
posted

Hi,

I used the following code to add a docked control in my form:

        public void DockControl(string area, string group, string key, string text, Control control)
        {
            if (control == null)
                return;

            if (ultraDockManager1.DockAreas.Exists(area))
            {
                DockAreaPane areaPane = ultraDockManager1.DockAreas[area];
                DockableGroupPane groupPane = null;
                if (areaPane.Panes.Exists(group))
                {
                    groupPane = areaPane.Panes[group] as DockableGroupPane;
                }
                if (groupPane == null)
                {
                    groupPane = new DockableGroupPane(group);
                    groupPane.ChildPaneStyle = ChildPaneStyle.TabGroup;
                    areaPane.Panes.Add(groupPane);
                }
                DockableControlPane pane = new DockableControlPane(key, text, control);
                groupPane.Panes.Add(pane);
                groupPane.Text = pane.Text;
         }
    }
   
   
            string leftKey = "LeftDockArea";
            DockAreaPane areaPane = this.ultraDockManager1.DockAreas.Add(DockedLocation.DockedLeft, leftKey);
            areaPane.Size = new Size(250, 150);

            string groupKey = "LeftDockGroup";
            this.DockControl(leftKey, groupKey, "Property", "Property", control);

 

I also added some UltraTree as the docked controls in the same way, and use ultraDockManager1.SaveAsXML/LoadAsXML to save/load the layout.

My problem is that when I load the layout back, it is a mess. I cannot even work with the tree and the application becomes no responding. I'm not sure if I use the ultraDockManager in the right way, can anyone tell me what is my problem? Thanks a lot!

 

  • 180
    posted

    Till now still no one can answer my question...

    I've tried to directly dock controls in the designer, every thing works fine after saving/loading the layout.

    But if I tried to dynamically dock controls using the code in my poster above, there would be some problem when loading the layout back.

    I cannot figure out what the problem is, the only difference that I can find compared to the designer auto-generated code is that I didn't define DockableWindow and WindowDockingArea in the code. But I also found that they are dynamically generated when running the application. So what is the real problem?