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

TabControl SelectedIndex

I am having an issue binding to SelectedIndex of the TabControl.  Here is my scenario:

I have a TabControl defined in a DataTemplate of a FlipView control.  The SelectedIndex is bound to a property on my ViewModel and not on the individual objects of the collection.  I want the same tab selected for each item as the user flips through the collection.  The problem I have is that after flipping items, then change tab, and flip items again it looks like I have two tabs selected.

I have attached an example.



DatatemplateBinding_fd13d87b.zip

3 Replies

SL Swasthika Lakshmi I Syncfusion Team January 30, 2013 01:10 PM UTC

Hi Dave,

We are not able to run the sample which you have provided. TabSelector class file is missing in the provided sample. Could you please provide us a running sample to proceed further.

Regards,
Swasthika Lakshmi.I



DD Dave Davis January 30, 2013 05:51 PM UTC



SL Swasthika Lakshmi I Syncfusion Team January 31, 2013 01:02 PM UTC

Hi Dave,

We are able to reproduce the SelectedIndex issue with TabControl. The fix for this issue will be available in our upcoming main release.

Right now, we can solve this issue by setting IsSelected property of the previous selected item to false in SelectionChanged of TabConrol. Please find the details in the below code snippet

 private void TabControl_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
 {
            TabItem previousItem = e.RemovedItems[0] as TabItem;
            if (previousItem != null)
                previousItem.IsSelected = false;

 }

Please let us know if you have any queries.

Regards,
Swasthika Lakshmi.I


Loader.
Live Chat Icon For mobile
Up arrow icon