Пример #1
0
        private async void _scrollView_ScrollChange(object sender, ScrollChangeEventArgs e)
        {
            var scrollValue = e.ScrollX - e.OldScrollX;

            currenScrollPositionX = e.ScrollX;
            if (!isCurrentlyTouched && !hasSnapped)
            {
                if (currentScrollView.carouselParent.SnapMode == Carousel.SnappingMode.Instant)
                {
                    hasSnapped = true;
                    await((CustomScrollView)Element).carouselParent.Snap(scrollDirection);
                }
                else if (currentScrollView.carouselParent.SnapMode == Carousel.SnappingMode.RollOut)
                {
                    if (Math.Abs(scrollValue) < SlowDownThreshold)
                    {
                        _scrollView.SmoothScrollBy(10 * scrollDirection, 0);
                        hasSnapped = true;
                        await((CustomScrollView)Element).carouselParent.Snap();
                    }
                }
            }
        }