#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 software development and sailing.

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

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

  2. Sarmad says:

    Hi,
    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. . .
    Thanks

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: