There is such a button:

<Button x:Name="btnVK" Margin="0,117,953,582" RenderTransformOrigin="0.567,0.409" Click="imgBtn1_Click" Foreground="{x:Null}" Background="{x:Null}" BorderBrush="{x:Null}"> <Image Source="Images/vk@3x.png" Stretch="Fill" IsEnabled="False" Width="36" Height="36" /> </Button> 

How to make it so that when you hover Image Source="" changed to another image. I tried to write styles, but nothing happened.

UPD: If I create <ControlTemplate TargetType="Button"> , then this is reflected in all buttons.

  • one
    <ControlTemplate TargetType="Button"> - specify Key="MyStyle" and will not be on all buttons. In the desired, just specify Style="{StaticResource MyStyle}" . - EvgeniyZ
  • Possible duplicate question: Changing the picture when you hover WPF - Andrew NOP

1 answer 1

  <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Source" Value="pack://application:,,,/Resources/reminder_Delet.png"/> </Trigger> <Trigger Property="IsMouseOver" Value="False"> <Setter Property="Source" Value="pack://application:,,,/Resources/reminder.png"/> </Trigger> </Style.Triggers> 

Taken from here