views:

606

answers:

3

I've implemented the MVVM pattern and have some viewModels that are bound to tab pages on a tab control.

When a specific object type changes (i.e. from Car myVehical, to Bike myVehical), then i want the relevant tab page to become selected.

Thanks.

A: 

Rather than using a tab control, you can use DataTemplates. The view itself will get set automatically based on the object you set as the content.

Scott Whitlock
ok, so how would that look as I still want the same look and feel as tab pages, i.e user can still select other tabs if necessary. sorry i'm new and never used datatemplates yet. thanks
HAdes
@HAdes - right. I like Martin's idea.
Scott Whitlock
+2  A: 

You could hack it by using a custom IValueConverter. You could then bind TabControl.SelectedIndex to a property on your view model and use the converter to convert from the type (Car or Bike) to an index. The value converter code would have to be updated when you change the tabs.

Martin Liversage
A: 

How can I access, to set visible or hidden, or active or inactive a specific tabItem?


Thanks in advanced

You need to post a question rather than an answer to another question. Plus you might want to reword it so others can get a better understanding of your issue.
HAdes