I understand that i can overlay an image on a button, but is it possible that a button can take the exact size of an image? In other words, i want to get rid of the rectangular shaped button and adapt it to the size and shape of the image.
You can set the Template of button like below:
<Button >
<Image Source="pan-left.png"/>
<Button.Template>
<ControlTemplate TargetType="Button">
<ContentPresenter Content="{TemplateBinding Content}"/>
</ControlTemplate>
</Button.Template>
</Button>
TemplateBinding is used to set the Content property in order to set the Content inside the ControlTemplate, as you can move this ControlTemplate to the Resources and can use it for multiple button and you can set the content on button itself
Check this Question.
You can re-template the button.
<Button x:Name="btn16x16">
<Button.Template>
<ControlTemplate>
<Border HorizontalAlignment="Center" VerticalAlignment="Center" >
<Image Source="pack://siteoforigin:,,,/Resources/SixteenBySixteen.png"
Width="16"
Height="16"/>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With