Search code examples
c#windows-8zoomingscrollviewerpinchzoom

How can I get the PinchZoom ended event in Windows 8?


I'm using XAML with C#. I have an Image in a ScrollViewer that is Zoomable. If the user pinchzooms the image, I want to get a larger resolution image once the optical zooming is done and replace it with the lower resolution zoomed image. I don't want to get a larger image for every event captured. Only when the user is done zooming. Hope this is clear. Thanks in advance.


Solution

  • I figured it out. Hook up to the ViewChanged event of the scroll viewer, then when the event is fired, check for e.IsIntermediate in the ScrollViewerIsViewChangedEventArgs.

    e.g:

    private void ScrollViewer_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
    {
      if(!e.IsIntermediate)
      {
        //Load new image depending on the zoom factor
      }
    }
    

    It ISN'T intermediate when the user is done pinch zooming.