I am making a windows phone 8.1 application using C# and XAML and I want to implement an Image map.
I know how to do it in HTML using img
tag's usemap
attribute, but how using C# and XAML?
Asked
Active
Viewed 209 times
0

human torch
- 303
- 5
- 15
-
Have a look at this: http://stackoverflow.com/questions/14404014/is-there-any-way-of-doing-an-image-map-on-xaml – BunkerMentality May 08 '15 at 13:34
1 Answers
0
You want to do something like this:
<Canvas xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="500" Height="500">
<Canvas.Background>
<ImageBrush ImageSource="yourBackgroundImage.jpg" Stretch="Fill"/>
</Canvas.Background>
<Rectangle Width="50" Height="25" Canvas.Top="100" Canvas.Left="100" />
<Rectangle Width="100" Height="20" Canvas.Top="200" Canvas.Left="300" />
<!-- etc -->
</Canvas>
The Canvas
with a background image is analogous to your <img>
and the set of Rectangle
elements are similar to your <area>
tags inside your <map>
. You can add events to the Rectangle
for things like Tap
, you could give them a Fill
property to make them a given color, etc.

Andy_Vulhop
- 4,699
- 3
- 25
- 34