Having a basic list scoll is a key scenario for many applications. The Silverlight Windows Phone 7 list box control makes it easy to bind data and get the performance benefits of UI container virtualization. However, in order to get these free performance benefits you need to be careful about how you use it.
Here are some tips on how to tweek your list box scroll performance published by the Silverlight Windows Phone 7 Perfomance Team.
Simplify ListBox Item
Listbox’s VirtualizingStackPanel (VSP), calculates the height of items currently in the view and buffers the UI containers for a screens worth of items above and below what is currently in the view. This works great if the items are of fixed size. If you change the size of the items, the UI virtualization breaks and you don’t get any performance benefits.
- Ensure you have the item data template in a fixed sized container (grid).
- Avoid/remove using complex converters, when the same information can be easily provided by the data object.
- Avoid/remove nested structures, example listbox in a listbox item.
- Strongly recommended to not use user control inside the data template.
- Avoid/remove custom controls from the data template
Load the images in background
If you have refered to the performance document, you will know the importance of keeping the UI thread free for better responsiveness to handle input. This means that if you load the images on the UI thread, an input like flick might be lost. David talks about how to move the image loading to a single background thread in his blog LowProfileImageLoader.