Once a DockableControlPane with a specified key is created and added either directly to a DockArea, or to a DockableGroupPane, how can you completely remove the DockableControlPane from the UltraDockManager control so that UltraDockManager.PaneFromKey("Key of the removed pane") returns Nothing?I have used Panes.Remove(MyPane), but an instance of the pane still resides within the UltraDockManager. I have also tried MyPane.Dispose() which still leaves an instance of a pane with the specified key in the UltraDockManager.How can a pane be completely destroyed?
You can either remove the pane from the ControlPanes collection of the dock manager. Alternatively, if you will not be using the associated control anymore, you can just dispose the control and its pane will automatically be removed from the dock manager.
Looks like you guys have a nasty little bug in here that is causing a memory leak.
If you remove the pane, or dispose of it, the control is removed from ControlPanes OK. However, if the pane is a tabbed MDI Window then the internal MDIChildForms of the UltraDockManager is not cleared of the pane and it will therefore never be disposed causing a memory leak. This collection just keeps growing and growing as the user opens and closed new windows.
I have found NO WORKAROUND for this and it's KILLING my app. HELP!
The following code is used to create a test window:
Control ctrl = new TextBox(); ctrl.Dock = DockStyle.Fill; DockAreaPane areaDock = ultraDockManager1.DockControls(new Control[ { ctrl }, DockedLocation.Floating, ChildPaneStyle.TabGroup); DockableControlPane pane = areaDock.Panes[0] as DockableControlPane; count++; pane.Text = "Foo " + count.ToString() ; pane.Key = pane.Text; pane.Settings.AllowClose = Infragistics.Win.DefaultableBoolean.True; pane.Settings.AllowFloating = Infragistics.Win.DefaultableBoolean.True; pane.IsMdiChild = true; pane.Settings.AllowDockAsTab = Infragistics.Win.DefaultableBoolean.True; pane.Settings.AllowDockBottom = pane.Settings.AllowDockLeft = pane.Settings.AllowDockRight = pane.Settings.AllowDockTop = Infragistics.Win.DefaultableBoolean.False; pane.Activate();
using the following code to clean up:
private void DestroyClosedPanes() { foreach (DockableControlPane pane in ultraDockManager1.ControlPanes) { if (pane.Closed) { if (pane.Control != null) pane.Control.Dispose(); //removes from DockManager collections pane.Dispose(); } } } private void ultraTabbedMdiManager1_TabClosed(object sender, Infragistics.Win.UltraWinTabbedMdi.MdiTabEventArgs e) { DestroyClosedPanes(); }