In order to make an Image
(or any other visual element) zoomable we have to add a PinchGestureRecognizer
to it. Here is how to do it in code:
var pinchGesture = new PinchGestureRecognizer();
pinchGesture.PinchUpdated += (s, e) => {
// Handle the pinch
};
image.GestureRecognizers.Add(pinchGesture);
But it can also be done from XAML:
<Image Source="waterfront.jpg">
<Image.GestureRecognizers>
<PinchGestureRecognizer PinchUpdated="OnPinchUpdated" />
</Image.GestureRecognizers>
</Image>
In the accompanied event handler you should provide the code to zoom your image. Of course other uses can be implement as well.
void OnPinchUpdated (object sender, PinchGestureUpdatedEventArgs e)
{
// ... code here
}
Other gestures are Tap and Pan.