void CheckForEmptySource()
        {
            var wasEmpty = _isEmpty;

            _isEmpty = ItemsSource.ItemCount == 0;

            if (_isEmpty)
            {
                _measurementCells.Clear();
                ItemsViewLayout?.ClearCellSizeCache();
            }

            if (wasEmpty != _isEmpty)
            {
                UpdateEmptyViewVisibility(_isEmpty);
            }

            if (wasEmpty && !_isEmpty)
            {
                // If we're going from empty to having stuff, it's possible that we've never actually measured
                // a prototype cell and our itemSize or estimatedItemSize are wrong/unset
                // So trigger a constraint update; if we need a measurement, that will make it happen
                ItemsViewLayout.ConstrainTo(CollectionView.Bounds.Size);
            }
        }
 public virtual void UpdateItemsSource()
 {
     _measurementCells.Clear();
     ItemsViewLayout?.ClearCellSizeCache();
     ItemsSource = CreateItemsViewSource();
     CollectionView.ReloadData();
     CollectionView.CollectionViewLayout.InvalidateLayout();
 }