Hi,
Problem here is, i create an user control with some rich ui controls and functionality.
Then I set that user control as a content in a ContentPane and added into tab container as document at runtime.
If i close the tab pane using tab header / (x) icon / context menu -> close,
The pane get close but the content remain in memory. How?
(I tried with CloseAction = RemovePane and HidePane)
Actually i binded a command in user control, even after closed the window the canexecute fires oftenly.
So, How to destroy the content when close the content pane?
Regards,
Ramesh.P
Sorry Alex and Smith for late reply. The Alex solution is not working.
Please see the attached solution.
Steps to reproduce:
1. Click the 'Load App'
2. Click the 'Unload App.
3. Goto to code editor (In Debugging mode) Place a break point in Line 30 in App1.xaml.cs.
4. Come program running window.
you can watch the debug will hit the can_execute. The hole object sitting inside.
This is make me big performance issue. Please provide a solution.
Thanks.
As Alex stated setting the CloseAction to RemovePane would remove the ContentPane and all elements that reference it. It's possible that something else is holding a reference to the pane. Do you have a sample that reproduces the issue?
Hello Ramesh,
You can use ContentPaneCommands.Close and CloseAction to RemovePane, like this:
cp.CloseAction = PaneCloseAction.RemovePane;
cp.ExecuteCommand(ContentPaneCommands.Close);