Articles in this section

How to update the children collection when TabItem get closed in DocumentContainer?

To update the children collection when any of the TabItem get closed in the Document container, Remove method of DocumentContainer Items collection can be used. The same has been demonstrated in the following code example:

XAML:

<Window x:Class="DocumentContainer_KB.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
Title="MainWindow" Height="350" Width="525" >
<Grid x:Name="Grid1">
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button x:Name="Button1" Width="100" Height="23" Click="Button1_Click" Content="Remove children" Grid.Row="0"/>
<syncfusion:DocumentContainer x:Name="Container" Mode="MDI" Grid.Row="1">
<ContentControl x:Name="Content1" syncfusion:DocumentContainer.Header="Document1"/>
<ContentControl x:Name="Content2" syncfusion:DocumentContainer.Header="Document2"/>
<ContentControl x:Name="Content3" syncfusion:DocumentContainer.Header="Document3"/>
<ContentControl x:Name="Content4" syncfusion:DocumentContainer.Header="Document4"/>
</syncfusion:DocumentContainer>
</Grid>
</Window>
 

 

C#

using Syncfusion.Windows.Tools;
 
namespace DocumentContainer_KB
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
 
}
 
private void Button1_Click(object sender, RoutedEventArgs e)
{
//It is used to remove the item from the collection:
Container.Items.Remove(Content1);
}
}
}
 

 

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