dockingmanager PRISM Close Tab and free Memory

Hi there,

I would like to use the following . WPF Application, Prism Framework, dockingmanager in main window,

The docking manager has the region property. As shown in the prism section in the docking manager manual.

Now I like to close tabs and free the memory. Sometimes views are bigger and use a lot of memory.

How can this be done? 

Regards

Oliver


1 Reply

GT Gokul Thanudhas Syncfusion Team August 4, 2022 02:49 PM UTC

Hi Oliver,


Closing the tab interactively will move the tab to the hidden state, so that it can be restored. If you want to clear the memory while closing the tab, you need to remove the item from the children collection of DockingManager. Please refer to the below codesnippets using DockStateChanged event.


CodeSnippet


private void DocumentRegionActiveAwareBehavior_DockStateChanged(FrameworkElement sender, DockStateEventArgs e)
 {
   if(e.NewState==DockState.Hidden)
    {
      dock.Children.Remove(sender);
    }
 }


If you want to close the tab programmatically you can remove the tabitem from the children collection of DockingManager.


Regards,

Gokul T.


Loader.
Up arrow icon