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
1104
Closing a DockableControlPane
posted

Hi,

I use UltraDockManager for displaying UserControls in tab form.

I use this code:

internal static class common

{

        public static DockableGroupPane grouppane;
        public static Form mainform;

}

static common()

{

            grouppane = new DockableGroupPane();
            grouppane.ChildPaneStyle = ChildPaneStyle.TabGroup;

}

To open a new pane programmatically:

public static void openPane(UserControl form)
        {

            mainform.SuspendLayout();

            var page = new DockableControlPane(form);

            grouppane.Panes.Add(page);

           
            page.Activate();

            mainform.ResumeLayout();
        }

 

The problem is:

When I click the "X" button of the DockableControlPane, the pane disappears, but is not really closed. It stays in the Panes collection of the DockableGroupPane.

E.g. if I want to open the same pane again after closing it before, i get an error "key exists in collection", because the pane was not correctly closed.

How can I completely close a pane, including the UserControl?

Please let me know if you need more information.

Best regards

Parents
  • 380
    Offline posted

    We have a similar problem (see http://community.infragistics.com/forums/t/47647.aspx).

    When the X is clicked, we need to completely dispose of the DockArea/DockableControlPane including its control.  Specifically, we want to reset the UltraDockManager to a default set of panes.  We have also tried closing all ControlPanes and DockAreas, then clearing the collections, but to no avail:

                    // Close existing panes and dock areas
                    foreach (Infragistics.Win.UltraWinDock.DockableControlPane pane in this.ultraDockManager.ControlPanes)
                    {
                        pane.Close();
                    }

                    foreach (Infragistics.Win.UltraWinDock.DockAreaPane area in this.ultraDockManager.DockAreas)
                    {
                        area.Close();
                    }
                    
                    // Clear all existing panes and dock areas
                    this.ultraDockManager.ControlPanes.Clear();
                    this.ultraDockManager.DockAreas.Clear();

    This causes some odd behavior where the control on the first pane in the UltraDockManager is docked without a DockArea (i.e. unable to close).

    Anyone know how we can completely dispose of all panes in the UltraDockManager and create new ones?

Reply Children