Example #1
0
        public override void LayoutSubviews()
        {
            base.LayoutSubviews();

            if (CollectionView == null)
            {
                return;
            }

            CollectionView.Frame    = Bounds;
            CollectionView.ItemSize = Bounds.Size;

            //Set offset to current page if bounds change, eg if the device is rotated
            if (Bounds.AreSizesDifferent(_oldBounds)
                //Only snap if SelectedIndex is set
                && SelectedIndex >= 0)
            {
                CollectionView?.SnapToPage(SelectedIndex, animated: UseTouchAnimationsForAllNavigation);
            }
            _oldBounds = Bounds;
        }