#1,163 – Make an Image Clickable with a Control Template

You can allow clicking on an Image by using it as the control template for a Button.

In the example below, we define a button that consists of an image and a border that lights up when you hover over the image.

		<Button Click="Button_Click"
			    ToolTip="Click on Fred">
					<Border x:Name="theBorder" 
						<Image Source="Astaire.png" Height="45"/>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" TargetName="theBorder" 

Below, we can see the clickable Image in action.



About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #1,163 – Make an Image Clickable with a Control Template

  1. Pingback: Dew Drop – September 22, 2014 (#1860) | Morning Dew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: