Windows 8.1 Metro app - Pinch and zoom an Image

c#, pinchzoom, windows-8, windows-8.1, xaml

Solution

You can achieve this easily by wrapping your image with a ScrollViewer control.

<ScrollViewer ZoomMode="Enabled">
    <Image ............ />
</ScrollViewer>

Problem

Is there any way to implement pinch and zoom the image control inside XAML in Windows 8.1, i am trying Manipulation delta event. But that event not get fired, also i tried setting ManipulationMode="All". ``` <Image x:Name="kn" ManipulationMode="All" ManipulationDelta="kn_ManipulationDelta" HorizontalAlignment="Center" VerticalAlignment="Center" Height="315" Width="360" RenderTransformOrigin="0.5, 0.5"> <Image.RenderTransform> <CompositeTransform></CompositeTransform> </Image.RenderTransform> </Image> ``` And in cs file ``` private void kn_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e) { UIElement element = sender as UIElement; CompositeTransform transform = element.RenderTransform as CompositeTransform; if (transform != null) { transform.ScaleX *= e.Delta.Scale; transform.ScaleY *= e.Delta.Scale; transform.Rotation += e.Delta.Scale / Math.PI; transform.TranslateX += e.Delta.Translation.X; transform.TranslateY += e.Delta.Translation.Y; } } ``` Is there anything i have to set. Or i have to go with some other way?

Original source