Mobile Zone is brought to you in partnership with:

I have worked for several companies as a senior software developer and lead developer. I bave enterprise level programming experience on Web, Silverlight, and Windows Phone 7. I am a MVP in Device Application Development since 2011. Jevgeni has posted 40 posts at DZone. You can read more from them at their website. View Full User Profile

Windows Phone 7 ItemsControl Virtualization using VirtualizingStackPanel in Silverlight

  • submit to reddit

Usually I am using ListBox control in my Windows Phone 7 Silverlight applications to display a scrollable list of child controls. ListBox offers UI virtualization, that means that UI is loading ListBox items on demand to increase the performance and reduce memory allocation. One of the main keys to that is in using VirtualizingStackPanel as ItemsPanel Template for ListBox control.

Lately in one of my Windows Phone 7 projects I had to replace ListBox with ItemsControl, but ItemsControl does not offer UI virtualization for child items by default, so I had to add the same VirtualizingStackPanel to ItemsPanelTemplate element. Also I have modified the Template element to be able to add and access ScrollViewer for ItemsControl.

            <VirtualizingStackPanel />
        <ControlTemplate TargetType="ItemsControl">
            <!-- place your controls here-->


Published at DZone with permission of its author, Jevgeni Tšaikin. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)