views:

418

answers:

1
+1  A: 

In your code, you zoom the image by increasing the width and the height of the image. This will always happen around the top-left point. However, if you use a scaling transform, you can set the point around which the image should be scaled.

<Image x:Name="img" Margin="151,127,208,142" Source="Waterfall.jpg" Stretch="Fill">
                   <Image.RenderTransform>
                   <ScaleTransform x:Name="imagescale" ScaleX="1.2" ScaleY="1.2" CenterX="100" CenterY="100">
                   </ScaleTransform>
                   </Image.RenderTransform>
                   </Image>

This code sample was taken from here

This should enable you to set the scaling to the ClickPosition by binding it to a property.

On another note: I am not sure that you intended your scaling to work like that, but if you zoom in by 1.25, you should zoom out by 1/1.25 and not 0.75. That will keep zooming constant, where your zoom changes as you go along (i.e. if I zoom in twice and zoom out twice, I would not have a zoom of 1 anymore.)

Johannes