Let's say I have a Tab Control Bound to a collection on a ViewModel like so:
In this case, PresentationElements is an ObservableCollection of ViewModels on a parent ViewModel, which is the DataContext for the View (and thus for the TabControl as well). As you can see, I'm using a ContentTemplate selector... this just unites a View with the ViewModel.
This works quite happily. I get a set of tabs and appropriate content (Views) and headers. Now, I want to bind the IsEnabled property of each TabItem to a suitable property on the Data Context for that TabItem. Does that make sense?
Let's say I have ViewModelA, ViewModelB, and ViewModelC in my Observable. That will give me three TabItems (TabItem1, TabItem2, TabItem3, respectively) in the TabControl. I want to bind the IsEnabled property of TabItem1 to the IsEnabled property of ViewModelA, etc. I can't figure out how to do that.
I can't set it in the ItemsContainerStyle because you can use binding in Style Setters. I'm sure I'm missing something simple... any help would be quite helpful.