public FixedCellPanel()
    {
      // None of the Visual children of the FixedCellPanel will scroll. The needed scrolling
      // as demanded by the parent ScrollViewer will be manually transferred to the 
      // content (m_scrollingPanel) of the ScrollingCellsDecorator below.

      m_fixedPanel = new FixedCellSubPanel( this );

      m_splitter = new FixedColumnSplitter();

      m_scrollingPanel = new VirtualizingFixedCellSubPanel( this );

      m_scrollingCellsDecorator = new ScrollingCellsDecorator();
      m_scrollingCellsDecorator.Child = m_scrollingPanel;

      this.AddVisualChild( m_fixedPanel );
      this.AddVisualChild( m_splitter );
      this.AddVisualChild( m_scrollingCellsDecorator );

      // Used to get the correct item depending of the ZIndex
      m_visualChildren.Add( m_fixedPanel );
      m_visualChildren.Add( m_splitter );
      m_visualChildren.Add( m_scrollingCellsDecorator );

    }
Beispiel #2
0
        void IPrintInfo.UpdateElementVisibility(double horizontalOffset, double viewportWidth, object state)
        {
            IDictionary <string, object> visibilityState = (IDictionary <string, object>)state;

            Debug.Assert(visibilityState != null);

            double accumulatedWidth               = 0.0d;
            bool   firstCellInViewportFound       = false;
            double viewportLimitsHorizontalOffset = horizontalOffset + viewportWidth;

            foreach (Cell cell in this.GetVisibleCells())
            {
                Visibility cellVisibility = cell.Visibility;
                if (cellVisibility == Visibility.Collapsed)
                {
                    continue;
                }

                accumulatedWidth += cell.ActualWidth;

                bool isPastViewportStart = accumulatedWidth > horizontalOffset;
                bool isBeforeViewportEnd = isPastViewportStart && (accumulatedWidth <= (viewportLimitsHorizontalOffset));

                bool isFirstInViewport = (isPastViewportStart) && (!firstCellInViewportFound);

                if (isFirstInViewport)
                {
                    firstCellInViewportFound = true;
                }

                if (isPastViewportStart)
                {
                    // The cell is past the Viewport's start.
                    if ((isBeforeViewportEnd) || (isFirstInViewport))
                    {
                        // Either the cell is completely visible in the Viewport
                        // or we face a cell which is the first in the Viewport but does not completely fit in the Viewport.
                        FixedCellSubPanel.RestoreCellVisibility(cell, visibilityState);
                    }
                    else if (cellVisibility == Visibility.Visible)
                    {
                        // The cell is past the Viewport's end.
                        FixedCellSubPanel.HideCell(cell, visibilityState);
                    }
                }
                else if (cellVisibility == Visibility.Visible)
                {
                    // The cell is before the Viewport's start.
                    FixedCellSubPanel.HideCell(cell, visibilityState);
                }
            }
        }