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
Problems trying to save/load a run-time created dashboard
posted

I've asked before and never got an answer...and 2 years later, I'm still stuck.

I'm trying to create a dashboard of floating panes, each one with a control in it..

Here is my code to create a pane.

        private void AddGrid(SummaryQuery sq)
        {
            UltraGrid ug = CreateGrid(sq.ID, "This is a grid title that you shouldn't see");
            DockAreaPane dap = udmLayout.DockAreas.Add(DockedLocation.Floating, sq.ID);
            dap.FloatingLocation = new Point(100, 100);
            dap.Size = new Size(300, 300);
            DockableControlPane dcp = new DockableControlPane(sq.ID);
            dcp.Text = sq.Title;
            dcp.Control = ug;
            dap.Panes.Add(dcp);
        }

The code works fine and I'm able to move and dock the pane around.  In the FormClosing handler I have:

            udmLayout.SaveAsBinary(m_layoutFile);

In my FormLoad I have

            if (File.Exists(m_layoutFile))
            {
                try
                {
                    udmLayout.LoadFromBinary(m_layoutFile);
                }
                catch (Exception ex)
                {
                    BSSLog.Error(ex);
                }
            }

But it's not working.  The panes aren't being created or no error is given. 

I'm guessing that I'm creating the dynamic panes incorrectly.

Come on guys,  I've been a subscriber for years, but I've started using DevExpress for other things...don't make me leave you.

 

 

  • 6158
    Suggested Answer
    Offline posted

    Hello,

    Unfortunately without a little more context, I can't identify exactly where the issue is.

    Based on the code I see, the issue is most likely due to the UltraDockManager not being able to locate the control to dock (UltraGrid) when the LoadFromBinary() call is made. The UltraDockManager does not have the ability to instantiate any docked controls, so the control to be docked but be parented to the Form prior to the LoadFromBinary() call. Additionally, make sure the control being docked has its Name property set. Otherwise, the UltraDockManager has no means to locate the control during the serialization/deserialization processes.

    Note that instead of creating the DockAreaPane and DockableControlPane yourself, you should be able to use the UltraDockManager's DockControls() method.

    Please let me know if this helps or you need further assistance.

    Thanks,

    Chris