We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to update the TabItemCollection when any one of its TabItem gets closed?

To update the TabItemcollection when any one of its TabItemExt gets closed, set the CloseMode Property of TabControlExt to “Delete”.

CloseMode property:

The CloseMode is an enum that includes values as Hide and Delete that resides in the TabControlExt. When you click on the TabItemExt CloseButton and when the CloseMode is set to be Hidden, then the TabItemExt moves to the Hidden state. When the CloseMode is set to Delete, then the TabItemExt is removed from the TabControlExt, and it automatically gets deleted from the TabItems Collection.

You can achieve the above using the following code example.


The following is the Code Behind code example.



Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework: Product Version:
3605 01/29/2015 01/29/2015 WPF TabControlExt 4.5
Did you find this information helpful?
Craig Greenway May 10, 2016
Please can you provide details on how to set the TabControlExt CloseMode default at either runtime or design time. I add new tabs at runtime based on user controls but can't find how to access the TabControlExt as I don't specify this myself. I add tabs like this (TableEditor is a User Control): var newTable = new TableEditor(_selectedTableName) { Name = "TableEditor" + _selectedTableName }; TablesDockingManager.BeginInit(); DockingManager.SetDockingManager(newTable, TablesDockingManager); DockingManager.SetHeader(newTable, "Table " + _selectedTableName); DockingManager.SetState(newTable, DockState.Document); DockingManager.SetDesiredMinWidthInDockedMode(newTable, 200); TablesDockingManager.Children.Add(newTable); TablesDockingManager.EndInit();
Vijayalakshmi Roopkumar [Syncfusion] May 10, 2016
Hi Craig, Thank you for using Syncfusion Products, By default, TabItemExt in TabControlExt will not be removed from memory when we close the TabItem and its instances are maintained in memory. To clear the TabItemExt instance from memory, we need to set CloseMode as Delete. But it will not remove the child from Children collection of DockingManager. We can remove the child from Children collection of DockingManager by removing it from the children collection manually when the DockState is changed to Hidden. Please refer to the following code example. private void TableDockingManager_DockStateChanged(FrameworkElement sender, DockStateEventArgs e) { if(e.NewState == DockState.Hidden) { // Used to remove the children from the DockingManager TableDockingManager.Children.Remove(sender); } } Please find the sample from the following link: Sample link: http://www.syncfusion.com/downloads/support/forum/124023/ze/TabControlExt_124023-920575162 Regards, Vijayalakshmi V.R.
Add Comment
You must log in to leave a comment

Please sign in to access our KB

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon