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(); }
Hello Kagel,
Thank you for your response.
As you can see on the page I've linked below, NetAdvantage 2010 Volume 2 is no longer being maintained. I tried your code in our latest version and I did not get any exceptions.
http://ko.infragistics.com/help/product-lifecycle
I guess the bug is still present in version 10.2 ???
Here is my code
if (_groupList.Panes.Exists(key))
{
DockableControlPane pan = _groupList.Panes[key] as DockableControlPane;
_groupList.Panes.Remove(key);
pan.Dispose(); //???
}
if (!_groupList.Panes.Exists(key))
UserControl uc = ....
DockableControlPane pan = new DockableControlPane(key, title, uc);
_groupList.Panes.Add(pan); >>> bang, key already exists although the panes collection is emtpy ???
Is there any reasonable workaround ????
Hello,
I will be happy to assist you all with this issue.
Attached, you will find a sample that demonstrates what Mike Dour mentioned in his last post. Please run the sample and let me know if you have any questions regarding how to permanently remove a dockable control pane.
Is this issue fixed, I am running in to the same issue as reported here.
I agree. The pane is still in the collection. I have tried to Close the pane, Dispose the pane, and RemoveAt from the DockableControlPanesCollection. Nothing works that I have found. What I need is an example of the code to permanently remove a pane.