Why is button background defaulting to grey when IsPressed is true
Posted
by Dave Colwell
on Stack Overflow
See other posts from Stack Overflow
or by Dave Colwell
Published on 2010-04-27T00:26:05Z
Indexed on
2010/04/27
1:53 UTC
Read the original article
Hit count: 393
Hey all,
I have a simple problem. Using the IsPressed trigger i want to be able to set the background color of a button to something other than the default grey. Here is what the button looks like when it is not pressed
and here is what it looks like when it is clicked
Here is the trigger for the button. I know the trigger is firing correctly because of the glow effect around the edge of the button when it is clicked. I also know that the brush is correct because i tried it out as a background brush to see what it looked like.
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource ButtonHoverBrush}"/>
<Setter Property="BitmapEffect" Value="{DynamicResource ButtonHoverGlow}"/>
</Trigger>
<!-- This is the trigger which is working but the background color wont change -->
<Trigger Property="IsPressed" Value="True">
<Setter Property="BitmapEffect" Value="{DynamicResource ButtonHoverGlow}"/>
<Setter Property="Background" Value="{DynamicResource ButtonPressedBrush}" />
</Trigger>
</Style.Triggers>
© Stack Overflow or respective owner