예제 #1
0
 private void pauseAnimation()
 {
     if (scrollingStory != null)
     {
         scrollingStory.Pause();
         scrollingStory = null;
     }
 }
예제 #2
0
        private async Task <bool> scrollTo(double verticalOffset, bool useAnimation = false, double durationInMs = 300)
        {
            verticalOffset = Math.Max(0, verticalOffset);
            verticalOffset = Math.Min((dataSource.Count - 1) * itemHeight, verticalOffset);
            pauseAnimation();
            if (!useAnimation)
            {
                Canvas.SetTop(ContentPanel, -verticalOffset);
                return(true);
            }
            else
            {
                var story = this.scrollingStory = animateTo(verticalOffset, durationInMs);
                var ret   = await scrollingStory.AsTask();

                if (story == this.scrollingStory)
                {
                    this.scrollingStory = null;
                }
                return(ret);
            }
        }