WPF WTF #3: ListBox/View, Virtualising
In .NET 3.5 SP1, WPF saw some fantastic performance increases including one of my favourites – the virtualising stackpanel (VSP). VSP’s meant that the items in a listbox/etc that aren’t on screen aren’t rendered – they’re virtualised. This provides memory and CPU performance increases.
VSP has two modes, Standard and Recycling, where the latter reuses the UI containers when it can, just changing the content, doing this saves even more memory.
And here is what happens when I enable VirtualisingStackPanel on a ListView in MahTweets.
That looks a little more than 140 characters per tweet – it starts combining the text in items. Fantastic.
If I use an ItemsControl (which Listbox/View are derived from), everything works fine – but ItemsControl has its own problems.
Note, this happens with any textbox/RTB I’ve tried in a ListBox/View with Recycling enabled, not just with my fancy ItemTemplates.



