0

In my UWP app I'm trying to add support for zooming an image by double-clicking or via pinch-to-zoom gesture.

So I wrapped my image control inside a scrollviewer with ZoomMode=Enabled and got the pinch-to-zoom working. I can also listen to the DoubleTapped event on the scrollviewer and update its zoom factor by a call to ScrollViewer.ChangeView()

But a call to ScrollViewer.ChangeView() will change the zoom factor very abruptly and with no animation.

What I'd like to do is to change the zoom factor of the scrollviewer using an animation that has a bounce easing function.

Any ideas on how can this be done?

2 Answers2

0

What I'd like to do is to change the zoom factor of the scrollviewer using an animation that has a bounce easing function.

You could make a extent ScrollViewer like the open-source library Win RT XAML Toolkit

This library has a ScrollViewerExtensions which has a ZoomToFactorWithAnimationAsync method. When you use this method to change ScrollViewer's ZoomFactor, it will change with animation.

The ZoomToFactorWithAnimationAsync method actually adds a DoubleAnimation for ZoomFactor. You could see here for more detailed information.

Xie Steven
  • 8,544
  • 1
  • 9
  • 23
0

See my answer here:

How to scroll to element in UWP

There is a video demo attached.

zax
  • 844
  • 8
  • 14