Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows store app ScrollViewer.ChangeView() not working

Trying to make a scrollview zoom out in a windows store app triggered by the double tapped event.

this is the code where it's 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 tap, nothing happens. the event does fire and the method is run but nothing happens, the view remains in the zoomed in state.

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

this obsolete method:

 MainPhotoDisplayscrollViewer.ZoomToFactor(1);

works just fine, but sadly it has no animation which makes for a bad user experience. And is not really what I want.

any ideas as to why nothing happens?

like image 697
Essah Avatar asked Mar 20 '14 14:03

Essah


1 Answers

Another solution is to add a Task.Delay call before the instruction.

Really weird but it works.

await Task.Delay(1);
scroller.ChangeView(null, null, null, false); // whatever
like image 162
mcont Avatar answered Sep 30 '22 06:09

mcont