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. Image for the cookie policy date
close icon

Close specific tab in runtime


I have a documentcontainer where i load some usercontrols with an exit button, i only want to close the tab where exit button was pressed and want know how many tabs remains open?

how can i do that?


3 Replies

GT Gokul Thanudhas Syncfusion Team October 18, 2022 10:51 AM

Hi Luis,

We have prepared the sample based on your requirement. In this sample we have binded the command "syncfusion:TabControlCommands.CloseCurrentTabItem" with button in user control. Using this command you can able to close the Tab.

Generally, closing the tab will hide move the item to hidden. Due to this, the Items collection is not changed after removing the Tab. So we have removed the closed item from the collection in CloseButtonClick event. Now, using Items Collection you can get the number of items currently open.

Please refer to the attached sample for your reference


Gokul T

Attachment: WpfApp1_1790fe94.zip

LG Luis Gabriel October 18, 2022 11:14 AM

Hi, Gokul

thanks a lot,

one more question 

if I want to avoid an user can open the same tab more than once, how can I do it?

GT Gokul Thanudhas Syncfusion Team October 19, 2022 10:41 AM

Hi Luis,

We have prepared the sample based on your given information. Please refer to the sample and the video from the attachment for your reference.

If we misunderstood your query, please provide more information about your query. So that we can prompt a better solution.


Gokul T

Attachment: DocumentContainer_df8725aa.zip

Live Chat Icon For mobile
Up arrow icon