#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.



About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

2 Responses to #1,004 – Setting CanContentScroll Disables Virtualization

  1. Pingback: Dew Drop – February 7, 2014 (#1718) | Morning Dew

  2. Sarmad says:

    Hope you are doing well…
    My question is is there is any way which “CanContentScroll” remains enables in Virtualization in wpf 4.0
    if yes please suggest me. . .

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: