<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>