WPF VIRTUALIZATION

What is Virtualization:

Virtualization is a key component of Dynamic IT.

Virtualization helps isolate various computing resources.

With virtualization, computing components are essentially turned into-on-demand services.

If you trying to display more than 10,000 without Virtualized panel you run the risk of getting performance, responsiveness, and stability issues of your WPF Application.

In WPF Items controls such ListBox and TreeView use VirtualizedStackPanel as their default panel, to improve performance.

For example if we want to display 10,000 items on a ListBox box without VirtualizedStackPanel,

It will take for core i5 processor 9.068 seconds to load (first time loading) the application.

 <ListBox
            Grid.Row="3"
            ItemsSource="{Binding Path=Appointments}"
            ItemTemplate="{StaticResource ResourceKey=ListBoxAppointmentTemplate}">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel 
                        Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
        </ListBox>

On  the other hand if we load 10,000 items on a ListBox that support virtualization its take only 226 milliseconds to load the application.

<ListBox
            Grid.Row="3"
            ItemsSource="{Binding Path=Appointments}"
            ItemTemplate="{StaticResource ResourceKey=ListBoxAppointmentTemplate}">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel 
                        Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
        </ListBox>

Next post will cover how to implement custom virtualized panel.

Advertisements

About Idan Reuven

Idan is Microsoft Certified Proffesional Developer (MCPD) Idan Working As Senior Software developer. and specialize in professional application development with WPF, WCF, Entity Framework, XAML, HTML 5, Java Script , jQuery, MVC, MVVM, C#, C++, SQL Server Technologies.
This entry was posted in WPF. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s