dotnet/Documentation/compatibility/item-scrolling-a-flat-list-...

1.7 KiB

Item-scrolling a flat list with items of different pixel-height

Scope

Minor

Version Introduced

4.6.1

Version Reverted

4.6.2

Source Analyzer Status

Planned

Change Description

When an ItemsControl displays a collection using virtualization (IsVirtualizing=true) and item-scrolling (ScrollUnit=Item), and when the control scrolls to display an item whose height in pixels differs from its neighbors, the VirtualizingStackPanel iterates over all items in the collection. The UI is unresponsive during this iteration; if the collection is large, this can be perceived as a hang.

The iteration occurs in other circumstances, even in previous .Net releases. For example, it occurs when pixel-scrolling (ScrollUnit=Pixel) upon encountering an item with different pixel height, and when item-scrolling hierarchical data (such as a TreeView or an ItemsControl with grouping enabled) upon encountering an item with a different number of descendant items than its neighbors.

For the case of item-scrolling and different pixel height, the iteration was introduced in .Net 4.6.1 to fix bugs in the layout of hierarchical data. It is not needed if the data is flat (no hierarchy), and .Net 4.6.2 does not do it in that case.

  • Quirked
  • Build-time break

If the iteration occurs in .Net 4.6.1 but not in earlier releases - that is, if the ItemsControl is item-scrolling a flat list with items of different pixel height - there are two remedies:

  1. Install .Net 4.6.2.
  2. Install hotfix HR 1605 for .Net 4.6.1.

Affected APIs

  • T:System.Windows.Controls.VirtualizingStackPanel

Category

Windows Presentation Foundation (WPF)