예제 #1
0
        public bool ShouldContinueFillingUpSpace(
            ElementType elementType,
            int elementIndex,
            LayoutReference referenceInformation,
            Rect windowToFill)
        {
            bool shouldContinue = false;

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

            if (referenceInformation.RelativeLocation == ReferenceIdentity.Myself)
            {
                // always do yourself
                shouldContinue = true;
            }
            else
            {
                int stackingLines    = 0;
                int virtualizingLine = 0;
                int stackingLine     = 0;

                int visualIndex = m_indexCorrectionTable.ActualIndexToVisualIndex(elementIndex);
                DetermineLineInformation(visualIndex, out stackingLines, out virtualizingLine, out stackingLine);

                if (referenceInformation.RelativeLocation == ReferenceIdentity.BeforeMe)
                {
                    if (stackingLine == 0)
                    {
                        // we're in a new row, so is there room to the bottom?
                        shouldContinue = PointFromRectInVirtualizingDirection(windowToFill) + SizeFromRectInVirtualizingDirection(windowToFill)
                                         > PointFromRectInVirtualizingDirection(referenceInformation.ReferenceBounds) + SizeFromRectInVirtualizingDirection(referenceInformation.ReferenceBounds);
                    }
                    else
                    {
                        shouldContinue = PointFromRectInVirtualizingDirection(windowToFill) + SizeFromRectInVirtualizingDirection(windowToFill) > PointFromRectInVirtualizingDirection(referenceInformation.ReferenceBounds);
                    }
                }
                else                 // AfterMe
                {
                    if (stackingLine == stackingLines - 1)
                    {
                        // we're a container that is at the end of a column
                        shouldContinue = PointFromRectInVirtualizingDirection(windowToFill) < PointFromRectInVirtualizingDirection(referenceInformation.ReferenceBounds);
                    }
                    else
                    {
                        shouldContinue = PointFromRectInVirtualizingDirection(windowToFill) < PointFromRectInVirtualizingDirection(referenceInformation.ReferenceBounds) + SizeInVirtualizingDirection(m_cellSize);
                    }
                }
            }

            return(shouldContinue);
        }
예제 #2
0
        GetElementBounds(
            ElementType elementType,
            int elementIndex,
            Size containerDesiredSize,
            LayoutReference referenceInformation,
            Rect windowConstraint)
        {
            global::System.Diagnostics.Debug.Assert(elementType == ElementType.ItemContainer);

            // Nongrouping, this is exact and we don't even need the reference position
            return(GetItemBounds(elementIndex));
        }