why setting ScrollViewer.CanContentScroll to false disable virtualization

Park Wu picture Park Wu · Sep 16, 2010 · Viewed 23.7k times · Source

As most WPF developers know, setting ScrollViewer.CanContentScroll to false will disable virtualization; but I'd like to know how it works, because I try to enable virtualization while setting ScrollViewer.CanContentScroll to false.

Answer

rudigrobler picture rudigrobler · Sep 16, 2010

"ScrollViewer currently allows two scrolling modes: smooth pixel-by-pixel scrolling (CanContentScroll = false) or discrete item-by-item scrolling (CanContentScroll = true). Currently WPF supports UI virtualization only when scrolling by item. Pixel-based scrolling is also called “physical scrolling” and item-based scrolling is also called “logical scrolling”."

Virtualization requires an item-based scrolling so it can keep track of logical units (items) currently in view... Setting the ScrollViewer to a pixel-based scrolling there is no more concept of logic units but only pixels!!!