Clickable Regions with WPF/E and included Image

Its quite easy with ASP.NET Imagemap control to create clickable regions in a bitmap. I will do the same with WPF/E.

<Image Source="Image.png" Width="628" Height="471" Canvas.Top="0" Canvas.Left="0" />

 With the image element a reference is set  a external image. Next we define with Shapes like Polygon or Rectangle the regions and the Jscript which will be called.

<Rectangle Fill="#00FFFFFF" Width="57" Height="52.313"

MouseLeftButtonDown="java Script:StartAnimation" Canvas.Left="219" Canvas.Top="387"/>

The intresting part for me was the behavior depedency to the attributes Fill and Stroke. If you have only stroke and no Fill then only the line is "clickable". My sample uses a black color (RGB FFFFFF) and a aplha blend of 0. The result is that the rectangle is not visible but "clickable".

Published Saturday, March 24, 2007 9:50 PM by preishuber
Filed under: ,

Comments

# re: Clickable Regions with WPF/E and included Image

Wednesday, August 17, 2011 8:11 AM by anonymous

Well, resume next...

# re: Clickable Regions with WPF/E and included Image

Tuesday, April 24, 2012 10:16 AM by Matt

What about irregular regions like a half circle or triangle or something?  How do you define a shape like that?  If I can get that info then I think I can handle the click inside part.

Leave a Comment

(required) 
(required) 
(optional)
(required)