예제 #1
0
        void EnsureLayoutInitialized()
        {
            if (_initialized)
            {
                return;
            }

            if (!ItemsView.IsVisible)
            {
                // If the CollectionView starts out invisible, we'll get a layout pass with a size of 1,1 and everything will
                // go pear-shaped. So until the first time this CollectionView is visible, we do nothing.
                return;
            }

            _initialized = true;

            ItemsViewLayout.GetPrototype = GetPrototype;

            Delegator = CreateDelegator();
            CollectionView.Delegate = Delegator;

            ItemsViewLayout.SetInitialConstraints(CollectionView.Bounds.Size);
            CollectionView.SetCollectionViewLayout(ItemsViewLayout, false);

            UpdateEmptyView();
        }
예제 #2
0
        public override void ViewWillLayoutSubviews()
        {
            base.ViewWillLayoutSubviews();

            // We can't set this constraint up on ViewDidLoad, because Forms does other stuff that resizes the view
            // and we end up with massive layout errors. And View[Will/Did]Appear do not fire for this controller
            // reliably. So until one of those options is cleared up, we set this flag so that the initial constraints
            // are set up the first time this method is called.
            if (!_initialConstraintsSet)
            {
                ItemsViewLayout.SetInitialConstraints(CollectionView.Bounds.Size);
                UpdateEmptyView();
                _initialConstraintsSet = true;
            }
            else
            {
                LayoutEmptyView();
            }
        }
예제 #3
0
        void EnsureLayoutInitialized()
        {
            if (_initialized)
            {
                return;
            }

            _initialized = true;

            ItemsViewLayout.GetPrototype = GetPrototype;

            Delegator = CreateDelegator();
            CollectionView.Delegate = Delegator;

            ItemsViewLayout.SetInitialConstraints(CollectionView.Bounds.Size);
            CollectionView.SetCollectionViewLayout(ItemsViewLayout, false);

            UpdateEmptyView();
        }