Windows Store app ScrollViewer.ChangeView () not working

An attempt to make a scroll reduction in a Windows Store app caused by a double-click event.

this is the code that was supposed to happen

private void MainPhotoDisplay_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
{
    MainPhotoDisplayscrollViewer.ChangeView(null, null, 1.0F,true);
}

but if I zoom in, in the simulator and then double click, nothing will happen. the event fires, and the method fires, but nothing happens, the view remains in an enlarged state.

here is the documentation for it: http://msdn.microsoft.com/en-us/library/windows/apps/dn252762.aspx

this deprecated method:

 MainPhotoDisplayscrollViewer.ZoomToFactor(1);

It works just fine, but unfortunately it does not have animation, which creates a bad user experience. And in fact, I do not want this.

any ideas as to why nothing is happening?

+4
2

: http://social.msdn.microsoft.com/Forums/windowsapps/en-US/c3eac347-fe08-41bd-98cb-d97b6f260873/double-tap-to-zoom-image-windows-81-scrollviewerchangeview?forum=winappswithcsharp

, , , , scrollViewer. bool false, .

var period = TimeSpan.FromMilliseconds(10);
        Windows.System.Threading.ThreadPoolTimer.CreateTimer(async (source) =>
        {
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                var Succes = MainPhotoDisplayscrollViewer.ChangeView(null, null, 1.0F, false);
            });
        }, period);
+7

Task.Delay .

, .

await Task.Delay(1);
scroller.ChangeView(null, null, null, false); // whatever
+8

Source: https://habr.com/ru/post/1532676/


All Articles