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
No Data
Reply
  • 5
    Suggested Answer
    posted

    Hi!

    Recently I added the UltraControlManager to my MDI Form and I found the same problem.

    I solved adding the BeforePaneButtonClick to UltraControlManager like this and I worked fine for me:

     Private Sub udockmanager_BeforePaneButtonClick(sender As Object, e As Infragistics.Win.UltraWinDock.CancelablePaneButtonEventArgs) Handles udockmanager.BeforePaneButtonClick

                If e.Button = PaneButton.Close Then
                    For Each p As DockableControlPane In Me.udockmanager.ControlPanes
                        p.Close() 'close/hide the pane
                        p.Control.Dispose() 'unload its content
                    Next
                End If
            End Sub

    Hope this can help!

    Related articles:

    Panes do not seem to be closing correctly

    Closing a DockableControlPane

    Need Closing event of DockableControlPane

Children
No Data