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
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
Nevermind, had to cast e.Pane to a DockableControlPane ..
I would like to dispose of the hosted control manually, however there doesn't seem to be a property on the DockableControlPane to get the control object.
I think the proper way to dispose of a dock manager pane is to dispose of the embedded control, or at least set it to null in the DockableControlPane. The dock manager lazily scavenges empty panes.
Closing a pane with an embedded control just hides it.
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?