title: Change image on button on MouseOver XAML (WPF)
body: <p>I am working on application and one requirement is to change the image of the button on mouse hover.</p>
  
  <p>Below is my code for button,</p>
  
  <pre><code> &lt;Grid Margin="0 20 0 0" Name="ButtonsGrid" Width="300"&gt;
              &lt;Grid.ColumnDefinitions&gt;
                  &lt;ColumnDefinition/&gt;
                  &lt;ColumnDefinition/&gt;
                  &lt;ColumnDefinition/&gt;
              &lt;/Grid.ColumnDefinitions&gt;
                &lt;Button x:Name="AnswerButton" Style="{StaticResource hover2}"  Grid.Column="0" VerticalAlignment="Center" HorizontalContentAlignment="Center" Width="60" Height="60" Background="Transparent" IsEnabled="False" Click="AnswerButton_OnClick" BorderBrush="Transparent" BorderThickness="0" &gt;
                  &lt;Image Source="/Training.Project.Demo;component/Images/Answer.PNG"  Stretch="UniformToFill"/&gt;
              &lt;/Button&gt;
  </code></pre>
  
  <p></p>
  
  <p>And below is the style i am applying,</p>
  
  <pre><code>&lt;Style x:Key="hover2" TargetType="Button"&gt;
          &lt;Setter Property="OverridesDefaultStyle" Value="True"/&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="Button"&gt;
                      &lt;ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"&gt;
                          &lt;ContentPresenter.Content&gt;
                              &lt;Border Name="border" 
                                        BorderThickness="0"                         
                                        BorderBrush="Transparent"                          
                                        Background="{TemplateBinding Background}"&gt;
                                  &lt;Image x:Name="ButtonImage1" Source="/Training.Project.Demo;component/Images/Answer.PNG" Height="17" Width="17" /&gt;
                              &lt;/Border&gt;
                          &lt;/ContentPresenter.Content&gt;
                      &lt;/ContentPresenter&gt;
                      &lt;ControlTemplate.Triggers&gt;
                          &lt;Trigger Property="IsMouseOver" Value="True"&gt;
                              &lt;Setter TargetName="border" Property="BorderBrush" Value="Black" /&gt;
                              &lt;Setter TargetName="ButtonImage1" Property="Source" Value="/Training.Project.Demo;component/Images/answer-hover.PNG" /&gt;
                          &lt;/Trigger&gt;
                      &lt;/ControlTemplate.Triggers&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  </code></pre>
  
  <p>I am not sure what wrong am i doing but the above code is not working.</p>
  
  <p>Any help would be appreciated</p>