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(); }
I would recommend submitting this issue to the support group: http://es.infragistics.com/gethelp. In the meantime, you can implement this workaround: Handle the ultraTabbedMdiManager1's TabClosing event like this:
private void ultraTabbedMdiManager1_TabClosing( object sender, CancelableMdiTabEventArgs e ){ MdiChildForm form = e.Tab.Form as MdiChildForm;
if ( form != null ) { DockableControlPane pane = form.Pane;
pane.IsMdiChild = false;
if ( pane.Control != null ) pane.Control.Dispose(); //removes from DockManager collections
pane.Dispose();
e.Cancel = true; }}
I tried this as well and it does not work. The pane is still in the collection forever with an empty key name (it appears that way when I examine the collection. Yet when I try to add a new pane with the name of the one removed (that is now empty) I get the error that the key exists already. I am very confused as to how to do what seems would be a very simple thing - delete, destroy a pane that is hosting a control. Can you help me understand how to remove a pane (not just close the pane)
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://es.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.