views:

48

answers:

1

Hi,

in WPF I draw an image with an Image Control:

<Image x:Name="Image1" Width="150" Height="180" VerticalAlignment="Bottom" HorizontalAlignment="Center" Stretch="None"/>

Sometimes, the image is smaller than the control. So, what would be the best solution to show an Hand cursor (and get Click-Events) only if the mouse is on the image and not on a "non image part" in the Image Control?

Thanks in advance, Alexander

A: 

One solution might be to put the image control inside a Canvas and, when the image is added, change the image control's height and width to match the actual image.

Then you don't need to do any special processing to decide when the cursor is over the actual image or not.

ChrisF