protected internal override void OnQueryItems(VirtualPage page, AsyncQueryInfo queryInfo)
        {
            base.OnQueryItems(page, queryInfo);

            DataGridVirtualizingQueryableCollectionViewGroup collectionViewGroup =
                this.GetLinkedCollectionViewGroup(page.ParentVirtualList) as DataGridVirtualizingQueryableCollectionViewGroup;

            IQueryable queryableToUse;

            int virtualItemCount = collectionViewGroup.VirtualItemCount;

            bool queryableIsReversed;

            if ((!m_supportsPrimaryKeyOptimizations) || (queryInfo.StartIndex < (virtualItemCount / 2)))
            {
                queryableIsReversed = false;
                queryableToUse      = collectionViewGroup.Queryable.Slice(queryInfo.StartIndex, queryInfo.RequestedItemCount);
            }
            else
            {
                queryableIsReversed = true;

                int reversedStartIndex = virtualItemCount - (queryInfo.StartIndex + queryInfo.RequestedItemCount);

                queryableToUse = collectionViewGroup.ReversedQueryable.Slice(reversedStartIndex, queryInfo.RequestedItemCount);
            }

            System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(this.AsyncGatherItems), new object[] { queryInfo, queryableToUse, queryableIsReversed });
        }
Beispiel #2
0
 public DataGridVirtualizingQueryableCollectionViewGroup(
     object name,
     int initialItemsCount,
     int startGlobalIndex,
     DataGridVirtualizingQueryableCollectionViewGroup parent,
     int level,
     bool isBottomLevel)
     : base(name, initialItemsCount, startGlobalIndex, parent, level, isBottomLevel)
 {
 }
        protected override int OnQueryItemCountCore(VirtualList virtualList)
        {
            if (!this.IsConnected)
            {
                return(0);
            }

            DataGridVirtualizingQueryableCollectionViewGroup collectionViewGroup =
                this.GetLinkedCollectionViewGroup(virtualList) as DataGridVirtualizingQueryableCollectionViewGroup;

            Debug.Assert(collectionViewGroup != null);

            return(collectionViewGroup.QueryItemCount());
        }
Beispiel #4
0
        internal virtual IQueryable CreateUnsortedFilteredQueryable()
        {
            int level = this.Level;

            Debug.Assert((level > -1), "The DataGridVirtualizingGroupRoot should have overriden this method without calling base.");

            // Sub group.  Only group from parent, which will already be sorted.
            DataGridVirtualizingQueryableCollectionViewGroup parentCollectionViewGroup = this.Parent as DataGridVirtualizingQueryableCollectionViewGroup;

            IQueryable parentUnsortedQueryable = parentCollectionViewGroup.UnsortedFilteredQueryable;

            Debug.Assert(parentUnsortedQueryable != null);

            if (parentUnsortedQueryable == null)
            {
                return(null);
            }

            // Narrow the filter to this group's clauses.
            return(this.FilterQueryable(parentUnsortedQueryable));
        }