Exemple #1
0
        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;
        }
Exemple #2
0
        protected override void SetUpNewElement(ItemsView newElement)
        {
            Carousel = newElement as FormsCarouselView;

            base.SetUpNewElement(newElement);

            if (newElement == null)
            {
                return;
            }

            AddLayoutListener();
            UpdateIsSwipeEnabled();
            UpdateIsBounceEnabled();
            UpdateItemSpacing();
        }
Exemple #3
0
 public CarouselViewRenderer(Context context) : base(context)
 {
     FormsCarouselView.VerifyCarouselViewFlagEnabled(nameof(CarouselViewRenderer));
     _oldViews = new List <View>();
 }