Hello,
I want to close the Panes, and not just Hide them (put them in the ClosedPanes collection).
There is no CloseAction property on Pane, so how can i accomplish that?
I want to release the memory as the dynamically created documents/toolwindows are closed.
Thank you in advance,
Michael
Hello redbyron,
There is PaneClosing event of XamDockManager, which you could use when trying to close Panes either inside XamDockManager Panes collection or inside DocumentContentHost - in your case when closing documents/toolwindows. If you don't want those Panes to go into ClosedPanes collection you could Cancel the event and then check if the current pane is inside XamDockManager or is inside DocumentContentHost. The logic might look something like the following code snippet :
private void Pane_Closing_Event_Handler(object sender, CancellablePaneEventArgs e) { e.Cancel = true; if(this.igXamDockManager.Panes.Contains(e.Pane)) { this.igXamDockManager.Panes.Remove(e.Pane); } if (this.igXamDockManager.DocumentContentHost.Panes.Contains(e.Pane.OwnerPane as TabGroupPane)) { TabGroupPane tgp = e.Pane.OwnerPane as TabGroupPane; tgp.Panes.Remove(e.Pane as ContentPane); } }
If you still have question please feel free to ask! Regards, Nikola.
The pane closing event handler is fired only when the user clicks the "X" button of the pane right?
How can we close the pane programmatically which will cause this event to be fired? Removing from the panes collection does not cause this event to be fired.
Hello Nikola,
i handled the PaneClosing event, using the following snippet..
static void OnPaneClosing(object sender, CancellablePaneEventArgs e) { e.Cancel = true; if (_XamDockManager.Panes.Contains(e.Pane)) { _XamDockManager.Panes.Remove(e.Pane); return; } else if (e.Pane.OwnerPane is TabGroupPane) (e.Pane.OwnerPane as TabGroupPane).Panes.Remove(e.Pane as ContentPane); else if (e.Pane.OwnerPane is SplitPane) (e.Pane.OwnerPane as SplitPane).Panes.Remove(e.Pane); }
but i encounter the following issues...
1) When i close a ContentPane which is in a split container, The Pane becomes floating window
2) Ofcourse i cannot remove a pane from the ReadOnly FloatingPanes collection,
so the previous pane just does not close
3) The same applies for readonly UnpinnedPanes collection
Please give me a hint in order to overcome the mentioned limitations...
I hope that a CloseAction type will be available in the first SR of 2011.1
Regards,