Recently, I was facing performance issue while working with huge data. I need to bind those data inside a panel as Custom User Control & want to change the properties multiple times in a second. When I used less no's of data it was working fine, but, when I tried with more no of data, my application starts crying. It was a real pain to the application to start while loading those records & unfortunately I didn’t get any solution to that.
After doing a lot of analysis with VirtualizingStackPanel concept that I shared in my previous post “What is Virtualizing StackPanel?” didn’t solve my problem which I was facing due to huge no of data.
Here you will find some very good articles on step-by-step implementation of Virtual Panel:
- BenCon's IScrollInfo in Avalon part I
- BenCon's IScrollInfo in Avalon part II
- BenCon's IScrollInfo in Avalon part III
- Dan Crevier's Implementing a virtualized panel in WPF part I
- Dan Crevier's Implementing a virtualized panel in WPF part II
- Dan Crevier's Implementing a virtualized panel in WPF part III
- Dan Crevier's Implementing a virtualized panel in WPF part IV
Those are very nice articles to implement the custom virtual panel step-by-step & after implementation of this panel, I noticed a huge performance improvement in my application. This really helped me while working with a huge records.
Now, come to the basic concept of this virtual panel. What it actually does. It loads all the records in a different thread & populate them in the UI as much as records that can be viewable in the screen. While scrolling, it actually creates new object of the elements by virtualizing the existing elements. So, only those objects will be in the memory which are available in the screen. The rest will go for a cleanup process. Hence, improving the performance more & more…. depending on the visible UI elements.
See a nice example in this location: http://blogs.msdn.com/jgoldb/attachment/8116217.ashx