WPF draw Border on MouseOver
The problem is that your local value for the BorderBrush
property is taking precedence over your Style
Trigger
. This MSDN article describes how the effective value is resolved. Basically, remove the local value from the Border
element, and it should work. If you need to specify the property, you can do so in a Setter
in the Style
. Also, the second Trigger
is not needed, as the value will revert to the original value when the property switches back to false:
<Border BorderThickness="1" Background="Transparent" CornerRadius="0" Height="18" Width="18"> <Border.Style> <Style TargetType="Border"> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="BorderBrush" Value="LightBlue" /> </Trigger> </Style.Triggers> </Style> </Border.Style></Border>