So I got a tabcontrol that is bound to an list(has name and code). And this is working perfectly
<TabControl.ContentTemplate>
<DataTemplate>
<sp:ucercontroltest DataContext="{Binding}" strname="{Binding Path=name}" strcode="{Binding Path=code}" />
</DataTemplate>
</TabControl.ContentTemplate>
But if I would add a Button(btntestbutton) on usercontroltest with an event, that if the button is clicked I want the button to be disabled (btntestbutton.IsEnabled = false) then it gets disabled on ALL the usercontrols(tabs)! How can I prevent it from all being shared wich each other so If I for example want to disable the button on 1 usercontrol so that I don t automaticly disable all of them.
As far as i know
TabControlsreuse the controls created from theContentTemplate, one way to have a state unique to the tabs would be to bind theIsEnabledproperty of the button to a property on the VM of each tab, then the state would adjust on tab-switch. (Of course you then would need to adjust the VM property in the handler, not theIsEnabled)