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
680
Exception thrown when adding DockableControlPane to DockAreaPane
posted

Hello,

I am using an Infragistics docking manager in my application. In this application I have support for saving layouts and loading them again during runtime. The problem I am having is when I'm disposing an old layout. Below follows a code snippet of what happens when the user has disposed an old layout and selected to create a new one. LayoutWorkspace is a class that inherits from DockableControlPane.

            LayoutWorkspace layoutWorkspace = GenerateWorkspace();

            layoutWorkspace.RootWorkItem = RootWorkItem;

            layoutWorkspace.WorkspacePanel.Click += new EventHandler(OnLayoutWorkspace_Click);

            layoutWorkspace.SetName(workspaceName);

            layoutWorkspace.FlyoutSize = m_MainDockingArea.ActualSize;

            layoutWorkspace.WorkspacePanel.BackColor = Color.White;

            if (!m_DockingManager.DockAreas.Contains(m_MainDockingArea))

            {

                m_MainDockingArea = new DockAreaPane(DockedLocation.DockedLeft);

                m_DockingManager.DockAreas.Add(m_MainDockingArea);

            }

            m_MainDockingArea.Panes.Add(layoutWorkspace);

When this code executes, the if block runs which means that m_MainDockingArea is newly created. My problem is that the last row: "m_MainDockingArea.Panes.Add(layoutWorkspace);" throws an exception saying that I'm trying to use a disposed object. The object mentioned is an old window form that was part of the OLD DockAreaPane. Do you have any idea why this might be happening? I should also mention that it only happens during some special constalation of windows ie. most layouts I have are disposed perfectly fine. I should also mention that we are using v8.2 of infragistic WinForms dlls.