Reputation: 1650
When I set my tab item font weight to bold, all the controls within that tab become bold. How do I set just the text header of the tab item without affecting the controls?
Upvotes: 1
Views: 4771
Reputation: 1650
This is what I did to get it to work. Thanks, SeeSharp, for the hint.
<TabControl.Resources>
<Style TargetType="{x:Type TabItem}">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock FontWeight="Bold" Text="{Binding}"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</TabControl.Resources>
Upvotes: 4
Reputation: 1750
Use ItemTemplate to set template for tab header. Example:
<TabControl ItemsSource="{Binding Items}">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock FontWeight="UltraBold" Text="{Binding Caption}"/>
</DataTemplate>
</TabControl.ItemTemplate>
Upvotes: 3