public CarouselSpacingItemDecoration(IItemsLayout itemsLayout, FormsCarouselView carouselView)
        {
            var layout = itemsLayout ?? throw new ArgumentNullException(nameof(itemsLayout));

            switch (layout)
            {
            case GridItemsLayout gridItemsLayout:
                _orientation       = gridItemsLayout.Orientation;
                _horizontalSpacing = gridItemsLayout.HorizontalItemSpacing;
                _verticalSpacing   = gridItemsLayout.VerticalItemSpacing;
                break;

            case LinearItemsLayout listItemsLayout:
                _orientation = listItemsLayout.Orientation;
                if (_orientation == ItemsLayoutOrientation.Horizontal)
                {
                    _horizontalSpacing = listItemsLayout.ItemSpacing;
                }
                else
                {
                    _verticalSpacing = listItemsLayout.ItemSpacing;
                }
                break;
            }

            _carouselView = carouselView;
        }
示例#2
0
        protected override void SetUpNewElement(ItemsView newElement)
        {
            Carousel = newElement as FormsCarouselView;

            base.SetUpNewElement(newElement);

            if (newElement == null)
            {
                return;
            }

            UpdateIsSwipeEnabled();
            UpdateInitialPosition();
            UpdateItemSpacing();
        }
        protected override void SetUpNewElement(ItemsView newElement)
        {
            Carousel = newElement as FormsCarouselView;

            base.SetUpNewElement(newElement);

            if (newElement == null)
            {
                return;
            }

            AddLayoutListener();
            UpdateIsSwipeEnabled();
            UpdateIsBounceEnabled();
            UpdateItemSpacing();
        }
        protected override void SetUpNewElement(ItemsView newElement)
        {
            Carousel = newElement as FormsCarouselView;

            AddLayoutListener();

            Carousel.Scrolled += CarouselViewScrolled;
            base.SetUpNewElement(newElement);

            if (newElement == null)
            {
                return;
            }

            UpdateIsSwipeEnabled();
            UpdateIsBounceEnabled();
            UpdateInitialPosition();
            UpdateItemSpacing();
        }
 public CarouselViewOnScrollListener(ItemsView itemsView, ItemsViewAdapter <ItemsView, IItemsViewSource> itemsViewAdapter, CarouselViewLoopManager carouselViewLoopManager) : base(itemsView, itemsViewAdapter, true)
 {
     _carouselView            = itemsView as FormsCarouselView;
     _carouselViewLoopManager = carouselViewLoopManager;
 }
 public CarouselViewRenderer(Context context) : base(context)
 {
     FormsCarouselView.VerifyCarouselViewFlagEnabled(nameof(CarouselViewRenderer));
     _oldViews = new List <View>();
 }
示例#7
0
 public CarouselViewRenderer(Context context) : base(context)
 {
     FormsCarouselView.VerifyCarouselViewFlagEnabled(nameof(CarouselViewRenderer));
 }