1
Vote

Incorrect calculation of the scrollbar size when scrolling past the last few rows.

description

When going way down a ListView based VirtualizingWrapPanel and reaching the last few rows, the scrollbar's size is miscalculated as the visibleSections passed to ComputeExtentAndViewport decreases near the bottom extent of the list. I have worked-around this using the following few modifications:
  UIElementCollection _children;
  ItemsControl _itemsControl;
  IItemContainerGenerator _generator;
  private Point _offset = new Point( 0, 0 );
  private Size _extent = new Size( 0, 0 );
  private Size _viewport = new Size( 0, 0 );
  private int _visibleSections = 0;
  private int firstIndex=0;
  private Size childSize;
  private Size _pixelMeasuredViewport = new Size( 0, 0 );
  Dictionary<UIElement, Rect> _realizedChildLayout = new Dictionary<UIElement, Rect>();
  WrapPanelAbstraction _abstractPanel;
And then:
  private void Resizing( object sender, EventArgs e )
  {
     _visibleSections = 0;
And finally:
  private void ComputeExtentAndViewport( Size pixelMeasuredViewportSize, int visibleSections )
  {
     _visibleSections = Math.Max( _visibleSections, visibleSections );

     if( Orientation == Orientation.Horizontal )
     {
        _viewport.Height = _visibleSections;
        _viewport.Width = pixelMeasuredViewportSize.Width;
     }
     else
     {
        _viewport.Width = _visibleSections;
        _viewport.Height = pixelMeasuredViewportSize.Height;
     }

comments