You are trying to reach the IsSelected
property of the TabItem
from the TabItem.Header
and that can't be accomplished with an ordinary Trigger
. Instead, you need to use a DataTrigger
so that you can Bind
to the IsSelected
property with a RelativeSource Binding
:
<DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=
{x:Type TabItem}}}" Value="True">
<Setter TargetName="img" Property="Source"
Value="/WpfApplication1;component/Images/Tulips.jpg" />
<Setter TargetName="tb" Property="Foreground" Value="Red" />
<Setter Property="TextElement.FontWeight" Value="Bold"/>
</DataTrigger>