private void SetCurrent(DataRefBase <T> newItem, int newPosition, int count)
 {
     if (newItem != null)
     {
         _isCurrentBeforeFirst = _isCurrentAfterLast = false;
     }
     else if (count == 0)
     {
         _isCurrentBeforeFirst = _isCurrentAfterLast = true;
         newPosition           = -1;
     }
     else
     {
         _isCurrentBeforeFirst = newPosition < 0;
         _isCurrentAfterLast   = newPosition >= count;
     }
     _currentItem     = newItem;
     _currentPosition = newPosition;
 }
        public VirtualListCollectionView(VirtualList <T> list)
            : base(list.Cache.NumCacheBlocks, list.Cache.NumItemsPerCacheBlock)
        {
            _loadFunc         = list.Load;
            _sourceCollection = list;


            _sourceCollection.CollectionChanged += AtSourceCollectionChanged;             //EXPERIMENTAL "Add" Support

            // initialize current item and markers
            if (list.Count == 0)
            {
                _isCurrentAfterLast = _isCurrentBeforeFirst = true;
            }
            else
            {
                _currentPosition = 0;
                _currentItem     = list[0];
            }
            _needsRefresh = true;
        }
        public int IndexOf(DataRefBase <T> item)
        {
            var dataRef = item as CachedDataRef;

            return(dataRef != null && dataRef.List == this ? dataRef.Index : -1);
        }
 public void Insert(int index, DataRefBase <T> item)
 {
     throw new NotImplementedException();
 }
        private void SetCurrent(DataRefBase <T> newItem, int newPosition)
        {
            int count = newItem != null ? 0 : Count;

            SetCurrent(newItem, newPosition, count);
        }