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!
I finally figured out the issue.
Just because I didn't set the Name property of each dock control.
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?