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
750
SaveLayout and Dynamic panels/controls
posted

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

I’m having trouble saving my UltraDockManager layout.  I believe it’s because I’m dynamically creating my panes and controls, but I’m not sure.

 

Here is where I’m creating the basic 4 panes.  (I’m doing this in the Form_load)

 

      // create a dock area on the right to contain the rich text

      DockAreaPane dockAreaFloat = new DockAreaPane(DockedLocation.DockedRight);

      // initialize the size of the dock area

      dockAreaFloat.Size = new Size(120, 200);

      // contain the rich text pane in the dock area

 

      for (int i = 1; i < 5; i++)

      {

        DockableControlPane paneUC = new DockableControlPane();

        paneUC.Key = "paneUC" + i.ToString();

        paneUC.Text = "UC " + i.ToString();

       

        DashboardComponentUC UC = new DashboardComponentUC(m_store);

        UC.Title = "New " + i.ToString();

        UC.RaiseControlSettingsChanged += HandleSettingsChange;

        paneUC.Control = UC;

        dockAreaFloat.Panes.Add(paneUC);

      }

      udmDashboard.DockAreas.Add(dockAreaFloat);

 

      // if there is a layout file, load it up.

      if (File.Exists("C:\\a.xml"))

        udmDashboard.LoadFromXML("C:\\a.xml");

 

When I close the form, all I do is:

      udmDashboard.SaveAsXML("C:\\a.xml");

 

When I run the program and there is a saved layout file, I seem to end up with a couple of extra ‘DashboardComponentUC’ in the controls list, which makes things ugly.  if there isn't a saved layout file, everything is fine but obviously the saved layout wasn't loaded.

 

What am I doing wrong?  My goal is to build a ‘Dashboard’ with a variable number of panels, so I need to able to dynamically add them.

 

Any advice would be very helpful!

 

Thanks

 

Gene