I seem to miss something here: I want a TabControl with rounded Corners at the top. Thus, the first and the last TabItem should be different from the other ones. I can style all TabItems using styles but how can I style particularly the first and last TabItem / Header?
Reading the first and last element in the TabControl.Items list does not work because it is possible to add a non-TabItem control (e.g. a Button) to a TabControl which is then written into the TabControl.Items list and thus can not be casted to a TabItem. If I add a Button to a TabControl the TabControl automatically creates a TabItem but I don’t know how to access it.
I hope the problem is understandable…
I’d appreciate any answer!
I solved the problem using an “ItemContainerStyleSelector” which recieves an instance of my TabControl in it’s constructor. It can then loop through it’s parent’s items in the SelectStyle method and compare every item with the one passed to it by the tab control. It looks like this: