I have a tabitem defined as below
<TabControl x:Name="tbcItems" Background="Transparent" >
<TabItem x:Name="tbiMacros" Header="MACROS" Foreground="Green" FontWeight="Bold">
<Grid Grid.Column="0">
<ListBox Name="lbxMacro1" HorizontalContentAlignment="Stretch" BorderBrush="White" Foreground="White" Background="Transparent" Margin="10" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" PreviewMouseLeftButtonDown="ListBox_PreviewMouseLeftButtonDown"/>
</Grid>
</TabItem>
</TabControl>
what I want is to change the header of the first macro tabitem
I am only able to change it from code behind with that
tbiMacros.Header = new TextBlock()
{
Background = Brushes.Red,
Foreground = Brushes.Green,
Text = "MACROS",
Margin = new Thickness(0),
Padding = new Thickness(0),
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Stretch,
};
but when I do the effect is lousy for it doesn't extend to its full widht/height
thanks for any help
-----ADD------
I have not changed it in the xaml for it has no effect
<TabItem x:Name="tbiMacros" Header="MACROS" Foreground="Green" Background="Red" FontWeight="Bold">
...
</TabItem>
leads to nothings



You have to edit the template to perform this.
TabControlin the design viewHere is the generated code:
Then search for
<SolidColorBrush x:Key="TabItem.Selected.Background" Color="#FFFFFF"/>and replace the color value by what feats your needs.The style will only apply on the selected
TabControl.To apply it to many
TabControl: move it to application resources and reuse it.To apply it to all
TabControl:ItemContainerStyle="{StaticResource TabControlItemContainerStyle}"attributeItemContainerStyleat application level:A working demo is available here.