I tried to understand your problem and, I hope I guessed right.
If you work MVVM and you change DataContext
's, you probably have a view-model that contains the different view-models and the code that changes the DataContext
's.
Binding SelectedIndex
or SelectedItem
to the current view-model doesn't help since after the DataContext
had been changed the original view-model (the view-model that you was bound to) has already gone.
Try to add another property to the view-model that hold the code that changes the DataContext
's. This property can hold the SelectedIndex
for the TabControl
and, can be used when you change the DataContext
's.