#1,004 – Setting CanContentScroll Disables Virtualization

When you set ScrollViewer.CanContentScroll to false for a ListBox, you switch from scrolling on an item basis to scrolling on a pixel basis.  However, when you do this, virtualization on the VirtualizingStackPanel being used as an items panel is disabled.  This happens because the virtualization logic works on an item-by-item basis and so is turned off when you are scrolling on a pixel-by-pixel basis.

This means that when you have a large number of items in an ItemsControl, you’ll typically want to leave content scrolling enabled.

 

Advertisement