Пример #1
0
        internal NSIndexPath GetScrollToIndexPath(int position)
        {
            if (Carousel?.Loop == true && _carouselViewLoopManager != null)
            {
                return(_carouselViewLoopManager.GetGoToIndex(CollectionView, position));
            }

            return(NSIndexPath.FromItemSection(position, 0));
        }
Пример #2
0
        protected override int DetermineTargetPosition(ScrollToRequestEventArgs args)
        {
            if (args.Mode == ScrollToMode.Element)
            {
                return(ItemsViewAdapter.GetPositionForItem(args.Item));
            }

            if (!Carousel.Loop)
            {
                return(args.Index);
            }

            if (_carouselViewLoopManager == null)
            {
                return(-1);
            }

            var carouselPosition = GetCarouselViewCurrentIndex(Carousel.Position);
            var getGoIndex       = _carouselViewLoopManager.GetGoToIndex(this, carouselPosition, args.Index);

            return(getGoIndex);
        }