Finally, I found a way to do this: basically, you set a trigger that will see if the parent GridViewHeaderRowPresenter
is selected. All headers will then return true
to that property.
Then you check if the header has the mouse over it and only the selected header will return true
.
The result will be something like this:
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType={x:Type GridViewHeaderRowPresenter}},
Path=IsMouseOver}"
Value="True">
<Setter TargetName="HeaderBack" Property="Background"
Value="{StaticResource HeaderActiveColumnBackground}"/>
<Setter TargetName="PART_HeaderGripper" Property="Background"
Value="{StaticResource VerticalLineColor}"/>
</DataTrigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="HeaderBack" Property="Background"
Value="{StaticResource HeaderSelectedColumnBackground}"/>
</Trigger>
<Trigger Property="HasContent" Value="false">
<Setter TargetName="HeaderBack" Property="Background"
Value="{StaticResource HeaderDefaultColumnNoContentBackground}"/>
<Setter TargetName="PART_HeaderGripper" Property="Background"
Value="{StaticResource HeaderDefaultColumnNoContentBackground}"/>
</Trigger>
</ControlTemplate.Triggers>