Esempio n. 1
0
        public void EstimateElementBounds(
            ElementType elementType,
            int elementIndex,
            EstimationReference headerReference,
            EstimationReference containerReference,
            Rect window,
            out Rect pReturnValue)
        {
            pReturnValue = default;

            int totalItems;

            global::System.Diagnostics.Debug.Assert(elementType == ElementType.ItemContainer);
            totalItems = GetLayoutDataInfoProviderNoRef.GetTotalItemCount();
            global::System.Diagnostics.Debug.Assert(0 <= elementIndex && elementIndex < totalItems);

            int maxStackingLines;
            int virtualizingLine;
            int stackingLine;

            var visualIndex = m_indexCorrectionTable.ActualIndexToVisualIndex(elementIndex);

            DetermineLineInformation(visualIndex, out maxStackingLines, out virtualizingLine, out stackingLine);
            global::System.Diagnostics.Debug.Assert(maxStackingLines > 0);

            SetPointFromRectInVirtualizingDirection(ref pReturnValue, virtualizingLine * SizeInVirtualizingDirection(m_cellSize));
            SetPointFromRectInNonVirtualizingDirection(ref pReturnValue, GetItemStackingPosition(stackingLine));
            pReturnValue.Width  = m_cellSize.Width;
            pReturnValue.Height = m_cellSize.Height;

            return;
        }
Esempio n. 2
0
        EstimateElementIndex(
            ElementType elementType,
            EstimationReference headerReference,
            EstimationReference containerReference,
            Rect window,
            out Rect pTargetRect,
            out int pReturnValue)
        {
            pTargetRect  = default;
            pReturnValue = -1;
            int totalItems = 0;

            global::System.Diagnostics.Debug.Assert(elementType == ElementType.ItemContainer);
            totalItems = GetLayoutDataInfoProviderNoRef.GetTotalItemCount();

            int maxStackingLines = (totalItems > 0) ? DetermineMaxStackingLine() : 1;

            // We are non-grouped, this is an exact calculation
            global::System.Diagnostics.Debug.Assert(maxStackingLines > 0);

            // How many virtualizing lines does it take to get from the start to here?
            float virtualizingDistanceFromStart = Math.Max(0.0f, PointFromRectInVirtualizingDirection(window));
            int   virtualizingLineDistance      = (int)(virtualizingDistanceFromStart / SizeInVirtualizingDirection(m_cellSize));

            float stackingDistanceFromStart = Math.Max(0.0f, PointFromRectInNonVirtualizingDirection(window));
            int   stackingLineDistance      = (int)(stackingDistanceFromStart / SizeInNonVirtualizingDirection(m_cellSize));

            int targetVisualIndex = virtualizingLineDistance * maxStackingLines + stackingLineDistance;

            // clamp targetvisualIndex.

            int firstVisualIndex = m_indexCorrectionTable.ActualIndexToVisualIndex(0);
            int lastVisualIndex  = m_indexCorrectionTable.ActualIndexToVisualIndex(totalItems - 1);

            targetVisualIndex = Math.Min(targetVisualIndex, lastVisualIndex);
            targetVisualIndex = Math.Max(targetVisualIndex, firstVisualIndex);

            // With the final index, calculate its position
            int ignored;
            int virtualizingLine;
            int stackingLine;

            DetermineLineInformation(targetVisualIndex, out ignored, out virtualizingLine, out stackingLine);

            pReturnValue = m_indexCorrectionTable.VisualIndexToActualIndex(targetVisualIndex);

            SetPointFromRectInVirtualizingDirection(ref pTargetRect, virtualizingLine * SizeInVirtualizingDirection(m_cellSize));
            SetPointFromRectInNonVirtualizingDirection(ref pTargetRect, GetItemStackingPosition(stackingLine));

            return;
        }
Esempio n. 3
0
        public void EstimatePanelExtent(
            EstimationReference lastHeaderReference,
            EstimationReference lastContainerReference,
            Rect windowConstraint,
            out Size pExtent)
        {
            pExtent = default;

            int totalItems = 0;

            totalItems = GetLayoutDataInfoProviderNoRef.GetTotalItemCount();


            int maxStackingLine = DetermineMaxStackingLine();

            global::System.Diagnostics.Debug.Assert(maxStackingLine > 0);

            //actual panel size
            SetSizeInVirtualizingDirection(ref pExtent, GetVirtualizedExtentOfItems(totalItems, maxStackingLine));
            SetSizeInNonVirtualizingDirection(ref pExtent, GetItemStackingPosition(Math.Min(maxStackingLine, totalItems)));

            return;
        }