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;
        }
Exemplo n.º 2
0
 public CarouselViewOnScrollListener(ItemsView itemsView, ItemsViewAdapter <ItemsView, IItemsViewSource> itemsViewAdapter, CarouselViewLoopManager carouselViewLoopManager) : base(itemsView, itemsViewAdapter, true)
 {
     _carouselView            = itemsView as FormsCarouselView;
     _carouselViewLoopManager = carouselViewLoopManager;
 }