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.
Unfortunately, activation email could not send to your email. Please try again.

Remove TabItem (not hide) from TabControlExt

Thread ID:

Created:

Updated:

Platform:

Replies:

121433 Dec 14,2015 05:40 PM May 5,2016 01:42 AM WPF 5
loading
Tags: TabControlExt
Vladimir Culum
Asked On December 14, 2015 05:40 PM

Hello,

I am using TabControlExt. Items of TabControl are binded to ObservableCollection. I have SelectedItem binded to TItem in ViewModel.

When user select some item in menu, new item is added to ObsevableCollection and new TabItem is shown.

That is working fine.

In the TabControlExt there is close (x) button. When I click that button, TabItem is removed from TabControl.

Problem is that TabItem is not removed from Collection, it is just hidden.

When user make new selection through menu, all TabItems get show.

example:

1. user open 5 items (TabItem1, TabItem2, TabItem3, TabItem4, TabItem5)
2. user close 2 items (TabItem1 and TabItem3)
3. user make new selection and want to open TabItem6

In that moment, 6 TabItems are shown: TabItem1, TabItem2, TabItem3, TabItem4, TabItem5 and TabItem6

How can I source TabControlExt close button to remove selected item (TItem) from ObservableCollection that is ItemsSource of TabControlExt.

Thank You.

Victory Jessie Selvam D [Syncfusion]
Replied On December 15, 2015 05:29 AM

Hi Vladimir Culum,

Thank you for using Syncfusion products.

The value of CloseMode property in TabControlExt is Hide by default so it does not remove the tab item from collection when closed. We suggest you to set CloseMode.Delete for this property so that the closed tab item will be removed from the ItemCollection. We have prepared a sample and video to demonstrate the same and you can dowload it from the following link:

Knowlege Base link: https://www.syncfusion.com/kb/3605/how-to-update-the-tabitemcollection-when-any-one-of-its-tabitem-gets-closed

Sample: TabControl_Remove_Items

Video: Video

Regards,
Jessie

Vladimir Culum
Replied On December 15, 2015 01:42 PM

Jessie,

Thanks for quick reply.

I have different problem. I know CloseMode properties.

I have empty ObservableCollection TItems. When user click on menu item, new item is added in TItems and TabItem is shown.
When I click close button, Item is not removed from ObservableCollection, and next time I add new one, all items that were added is shown.

That is my problem.

Thanks.

Victory Jessie Selvam D [Syncfusion]
Replied On December 16, 2015 07:26 AM

Hi Vladimir Culum,

We have prepared a sample with menu for creating and selecting TabItemExt but still we were unable to reproduce the reported issue with that. Could you please update us your Essential Studio version and modified sample reproducing the issue? You can download the sample from the following link:

Sample: TabControl_Remove_Items

Regards,
Jessie

Vladimir Culum
Replied On May 4, 2016 06:13 PM

Sorry. I just realise that I didn`t make update on this issue.

I resolve the problem.

Problem was in my code arch. I make update to ObservableCollection that was bind to TabExt ItemsSource from service, and didn`t make TwoWay update onClose in my ViewModel.

This is working as expected.

Thank You.

Vijayalakshmi Roopkumar [Syncfusion]
Replied On May 5, 2016 01:42 AM

Hi Vladimir,

We are glad to hear that the issue has been resolved at your end. Please get back with us if you need any further assistance.

Regards,
Vijayalakshmi V.R.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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.

;