---
title: "Convert image to a button WPF"  
description: "Convert image to a button WPF"  
author: "Anonymous User"  
published: 2013-09-21  
updated: 2013-09-21  
canonical: https://www.mindstick.com/forum/1460/convert-image-to-a-button-wpf  
category: "wpf"  
tags: ["Convert image to a button WPF", "mindstick", "wpf", "Convert image"]  
reading_time: 1 minute  

---

# Convert image to a button WPF

I understand that i can [overlay](https://www.mindstick.com/blog/699/overlaying-the-action-bar-in-android-app) an [image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) on a [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net), but is it possible that a button can take the exact [size](https://www.mindstick.com/forum/159799/how-can-you-manage-the-size-of-mdf-and-ldf-files) 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.

## Replies

### Reply by Sumit Kesarwani

Hi Ankit,\

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.


---

Original Source: https://www.mindstick.com/forum/1460/convert-image-to-a-button-wpf

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
