I have a TabControl with a style that changes the FontSize of the Header of the TabItem. When I data bind the ItemsSource only the headers are affected by the FontSize. But when
Your problem is a result of Property Value Inheritance.
When you define the TabItem
s in xaml something like this:
Both TextBox
es, the header, and the content are in the logical tree of the TabItem
that means that any Inheritable property set on TabItem
will be propagated down the tree to these TextBox
es.
The Foreground
and FontSize
are Inheritable.
If you have something like:
TEST_CONTENT2
you don't have any Elements in TabItem
's logical tree, the elements for the Header and the content will be auto generated, and the properties will not be inherited.
But this type of declaring TabItem
's is not very useful, you usually need some advanced XAML as the items content so I think the best way to solve this is by changing all those text properties in TabItem
's HeaderTemplate
, you can bind to TabItem's
properties using the RelativeSource
.