EDIT: This control can be reused throughout a project as many times as you need it acts exactly as any other control would and is used the same way as any other control library. There is no Border effect and you can add whatever hover effect you want. This is how it works.
Add a folder named CustomControls to your solution.
Create a custom control(WPF) named ImageButton in that folder. The custom control code goes in there.
Now a folder named Themes should have been created in your project with a resourcedictionary named generic.xaml inside it. Open it and use the resourcedictionary code.
Now add this to your window tag
xmlns:b="clr-namespace:MyProject.CustomControls"
Now you can use the control in that window as many times as you'd like just like a regular button by using the tag structure at the end of the answer.
Here is one that I made you can set the Image source, height and width all from your main window and all standard button events are there.
Here is the custom control
namespace MyProject.CustomControls
{
public class ImageButton : Button
{
public static DependencyProperty SourceProperty =
DependencyProperty.Register(
"Source",
typeof(Uri),
typeof(ImageButton));
static ImageButton()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ImageButton), new FrameworkPropertyMetadata(typeof(ImageButton)));
}
public Uri Source
{
get { return (Uri)GetValue(SourceProperty); }
set { SetValue(SourceProperty, value); }
}
}
}
Here is the style in the resourcedictionary, you can add mouseover event and a button.pressed event in the triggers section or remove the triggers and set them on your window.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:b="clr-namespace:MyProject.CustomControls">
<Style x:Key="{x:Type b:ImageButton}" TargetType="{x:Type b:ImageButton}">
<Setter Property="Height" Value="{Binding Path=Height, RelativeSource={RelativeSource TemplatedParent}}"/>
<Setter Property="Width" Value="{Binding Path=Width, RelativeSource={RelativeSource TemplatedParent}}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type b:ImageButton}">
<Grid x:Name="LayoutGrid">
<Image x:Name="_Image" HorizontalAlignment="Center" VerticalAlignment="Center" Width="{TemplateBinding Width}"
Source="{Binding Path=Source, RelativeSource={RelativeSource TemplatedParent}}" Height="{TemplateBinding Height}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="" TargetName="" Value=""/>
</Trigger>
<Trigger Property="Button.IsPressed" Value="True">
<Setter Property="" TargetName="" Value=""/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
To use it in your project add the namespace to the window and then the tag will be like this
<b:ImageButton Source="Image.png" Height="50" Width="50" Click="do_Something"/>