I have a Button in XAML
<Button x:Name="btnclose" Click="btnclose_Click">
<Viewbox StretchDirection="Both">
<Image x:Name="imgclosebtn" Source="images/blackclosebtn.png" Margin="2"/>
</Viewbox>
</Button>
when I hover over the button I want to change the source of the image. How can I do this? I have already changed the backgroundcolor on hover:
<Style TargetType="Button">
<Setter Property="Background" Value="LightGray"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" BorderBrush="Black" BorderThickness="0">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Red"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
I have already tried it with TargetName and a Setter but it is out of scope
I preferably would like to do it in XAML, but C# is also ok