2

Closed

ScrollViewer animation strange behavior

description

I'm trying to use ScrollToHorizontalOffsetWithAnimation and ScrollToVerticalOffsetWithAnimation, and it works, but when the animation is completed the ScrollViewer returns to the {0, 0} position.

This is my code. As you can see, its very simple:
private async void ScrollTo(double x, double y)
{
scrollViewer.ScrollToHorizontalOffsetWithAnimation(x);
scrollViewer.ScrollToVerticalOffsetWithAnimation(y);
}
I tried using only one animation, but the result is the same.

Is this only happening to me?
Do anyone know how to solve this strange behavior?

Im using RTM.

Thanks!
Closed Nov 16, 2012 at 4:38 PM by xyzzer
Fixed.

comments

xyzzer wrote Oct 22, 2012 at 10:29 PM

Interesting. When you look at the sample app - it seems to be doing almost exactly what you are doing and it seems to work fine:

http://winrtxamltoolkit.codeplex.com/SourceControl/changeset/view/0657c67a93d5#WinRTXamlToolkit.Sample%2fViews%2fScrollViewerExtensionsTestPage.xaml.cs
        scrollViewer.ScrollToHorizontalOffsetWithAnimation(r.NextDouble() * (scrollViewer.ExtentWidth - scrollViewer.ViewportWidth));
        scrollViewer.ScrollToVerticalOffsetWithAnimation(r.NextDouble() * (scrollViewer.ExtentHeight - scrollViewer.ViewportHeight)); 
I have a feeling though that what you say might happen if you call the method twice in a row? I would need a sample repro project to have something to work with.

chrisntr wrote Nov 16, 2012 at 12:31 AM

Hey both, I'm having exactly the same problem, here's a very simple sample project of the issue: https://www.dropbox.com/s/v750njbqxhued38/ScrollViewerAnimation.zip

Very odd but I hope that helps,

ChrisNTR