I use graphic buttons with two pictures. The style of all is identical with the exception of background images (FontAwesome icons in PNG format). Code:

<Button x:Name="Close" Content="" ClickMode="Press" Focusable="False" BorderThickness="0" BorderBrush="Transparent" UseLayoutRounding="True" Height="42" Width="42" VerticalAlignment="Center" HorizontalAlignment="Center"> <Button.Style> <Style TargetType="{x:Type Button}"> <Setter Property="Background"> <Setter.Value> <ImageBrush ImageSource="ButtonCloseNormal.png"/> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background"> <Setter.Value> <ImageBrush ImageSource="ButtonCloseHover.png"/> </Setter.Value> </Setter> </Trigger> <Trigger Property="IsPressed" Value="True"> <!-- Unknown properties for hidding gray border and scalable effect of background image. --> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button> 

When you press the buttons after a short time, the button style changes - a gray border of 2 pixels is added and the size of the background image decreases.

Tell IsPressed what to add to the corresponding IsPressed trigger to override and disable these effects.

  • You need to edit the template, and not to hang additional triggers. - Andrei NOP
  • Those. IsPressed trigger IsPressed not needed, but it is enough to override the template in the button properties? - Rootware
  • Well, not just in the properties of the new template to describe, but rather to edit the existing one. Although you can fully describe if you are sure that you can handle it (take into account all the nuances). To start in the designer, right-click on your button and select "Edit Template" - "Edit a Copy ...", the studio will add a template, here it is and edit - Andrey NOP
  • Thank. I'll try, now, next week. - Rootware 1:21 pm
  • @ AndreyNOP is not in VS 2010 such an option. - Rootware 4:08 pm

0