Reputation: 3763
I have some Expander in my Window... I want when my Expander isExpanded its header background changed... How to I do this?
Upvotes: 1
Views: 3479
Reputation: 675
<Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}">
<Style.Triggers>
<Trigger Property="IsExpanded" Value="True">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<Border Background="Green">
<ContentControl Content="{Binding}"/>
</Border>
</DataTemplate>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsExpanded" Value="False">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<Border Background="Red">
<ContentControl Content="{Binding}"/>
</Border>
</DataTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
Upvotes: 2