Articles in this section
Category / Section

How to disable unloading of content in the DocumentTabItem in WPF DockingManager?

1 min read

While switching the DocumentTabItems in WPF DockingManager the content of previously selected tabitem will be unloaded.  IsDisableUnloadTabItemContent property of DockingManager is used to enable or disable unloading of DocumentTabItem content. If the value of IsDisableUnloadTabItemContent is true, content of previously selected tabitem will not get unloaded during tab switching.  The following code example demonstrates the same.

MainWindow.xaml:

<syncfusion:DockingManager UseDocumentContainer="True" x:Name="dockingmanager" IsDisableUnloadTabItemContent="True">
  <ContentControl x:Name="tab1" syncfusion:DockingManager.Header="DockTabItem1" syncfusion:DockingManager.State="Document" Unloaded="tab1_Unloaded"/>
  <ContentControl x:Name="tab2" syncfusion:DockingManager.Header="DockTabItem2" syncfusion:DockingManager.State="Document" Unloaded="tab2_Unloaded"/>
 </syncfusion:DockingManager>

MainWindow.cs

public partial class MainWindow : Window
{
  public MainWindow()
  {
    InitializeComponent();            
  }        
 
  private void tab1_Unloaded(object sender, RoutedEventArgs e)
  {
    // This event will trigger while selecting "DockTabItem2", if the property IsDisableUnloadTabItemContent is false.
  }
 
  private void tab2_Unloaded(object sender, RoutedEventArgs e)
  {
    // This event will trigger while selecting "DockTabItem1", if the property IsDisableUnloadTabItemContent is false.
  }
}

View sample in GitHub.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied