WPF VirtualizingStackPanel for increased performance WPF VirtualizingStackPanel for increased performance wpf wpf

WPF VirtualizingStackPanel for increased performance


There are two techniques that might be a big help. Both of them are described very well by Bea Stolnitz on her blog.

The first is UI Virtualizationand the second is Data Virtualization

In UI virtualization you use things like VirtualizingStackPanel to make the UI draw fewer things.

Data virtualization makes sure you don't bring a million objects into memory when you are only going to show 100.

So UI virtualization minimizes the number of things drawn and data virtualization minimizes the number of things that could be drawn.

Hope that helps


I had exact the same problem ind WPF using TabControl and DataGrid. By growing DataGrid element size, switching tabs becomes VERY slow ! After that I found this post reading the blog from Bea Stolnitz as supposed by the previous answer. That gave me the hint to google "wpf tabcontrol VirtualizingStackPanel"which gives me the link to DrWPF: http://groups.google.com/group/wpf-disciples/browse_thread/thread/6f3531a1720252dd

He describes exactly the problem and gives the solution :-))

.... The perf hit is during the building of the tree. Unfortunately, if
you're using a typical MVVM approach with a binding on the ItemsSource
property of the TabControl, the entire tree must be rebuilt each time
a tab item is selected. This is usually a very expensive operation. ....