windowsgm
windowsgm

Reputation: 1616

Image with Multiple Clickable Areas

I have an image that I want various parts of to be clickable. I found a comment in the question below mentioning this was possible with Expression Designer. I haven't been able to find a guide on how to do this. I understand that I have to export the image from Designer to Visual Studio. Is there a better way of achieving this or how do I go about creating the xaml for these clickable sections?

best way for clickable image map in wpf

Upvotes: 1

Views: 1838

Answers (1)

Mark Feldman
Mark Feldman

Reputation: 16119

Personally I'd use the second answer to that question i.e. do something like this:

<Canvas>
    <Image Source="background.png"/>
    <Ellipse Canvas.Left="82" Canvas.Top="88" Width="442" Height="216" Fill="Transparent" Cursor="Hand" MouseDown="Ellipse_MouseDown_1"/>
    <Ellipse Canvas.Left="305" Canvas.Top="309" Width="100" Height="50" Fill="Transparent" Cursor="Hand" MouseDown="Ellipse_MouseDown_2"/>
</Canvas>

Then you can drag and resize the shapes in DevStudio using it's XAML editor's design mode.

Upvotes: 2

Related Questions