tags:

views:

597

answers:

1

I have a WPF app with a Rectangle trigger defined as:

<Style TargetType="{x:Type Rectangle}">
   <Setter Property="Rectangle.StrokeThickness" Value="1"/>
   <Style.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
         <Setter Property="Rectangle.StrokeThickness" Value="4"/>
      </Trigger>
   </Style.Triggers>
</Style>

And a Rectangle as:

<Rectangle Fill="Blue" StrokeThickness="2" Stroke="Black" Height="20" Width="50" />

Rectangle doesn't change strokethickness when mouse is over. Why not?

+2  A: 

Remove the StrokeThickness="2" from your Rectangle object and it should work..

You are overriding the StrokeThickness style when you set the property directly on the Rectangle...

Arcturus