How to set MouseOver event/trigger for border in XAML? I want the border to turn green when the mouse is over it and then to return to blue when the mouse is no longer over the border. Why can't I just use the following code:
<Border
Name="ClearButtonBorder"
Grid.Column="1"
CornerRadius="0,3,3,0"
Background="Blue">
<Border.Triggers>
<Trigger Property="Border.IsMouseOver" Value="True">
<Setter Property="Border.Background" Value="Green" />
</Trigger>
<Trigger Property="Border.IsMouseOver" Value="False">
<Setter Property="Border.Background" Value="Blue" />
</Trigger>
</Border.Triggers>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="X" />
</Border>
I really don't get these triggers and styles in WPF. It is such a drag not to be able to achieve something simple as this.. Please provide the solution for me and help me understand what the heck is wrong with my code? Thanks a bunch.