Condividi tramite


Better performance for large data sets in Selector (ListBox, ListView, etc)

We've had feedback from a number of people about enumerations of the entire
collection and calls to Contains/IndexOf in controls that derive from Selector.
This has caused headaches for those that want to roll their own virtualization
solutions for these controls.

I have some good news and some better news.

The good news: you'll notice in the June CTP, that calls to IndexOf/Contains
should be pretty much eliminated while selecting items in ListBox/ListView (as
long as you are not binding to Selected Index). The lesson here: don't bind to
SelectedIndex if you are using a large or virtualized data set.

The better news: in the June CTP you'll notice we still walk the entire
collection when we load the data. A fix has just gone in to eliminate this walk.
If you have a list of 10,000 items, but only 50 are on screen. You'll only see
items accessed up to, say 52. This new fix will be out in an upcoming CTP
release.