Welcome to MSDN Blogs Sign in | Join | Help

Virtualized WPF Canvas

As you may already know WPF has a built-in virtualizing panel called VirtualizingStackPanel that supports UI virtualization and lays out its elements like StackPanel.

The WPF ListBox & ListView controls use this panel by default. Other containers controls such as Canvas do not have virtualization support in .Net 3.0 & 3.5.

Chris Lovett from Microsoft now wrote a great sample that shows how you can also virtualize a Canvas container control so it can efficiently host and scroll thousands of WPF elements without consuming huge amount of memory.  

The provided down-loadable ZIP has a white paper and the code.

Hope you find this useful.

Jossef.

Published Saturday, March 08, 2008 9:00 PM by jgoldb
Attachment(s): VirtualCanvas.zip

Comments

# MSDN Blog Postings » Performant Virtualized WPF Canvas

Sunday, March 09, 2008 11:54 AM by Pierrick's Blog

# WPF, Un canvas virtuel

WPF nous fournit par défaut un 'VirtualizingStackPanel' qui nous permet de virtualiser les éléments graphiques

Tuesday, March 25, 2008 3:16 PM by WPF Performance

# Quick tips to improve WPF app memory footprint.

We sometimes hear concerns that WPF applications memory foot print is too large. This could be because

Wednesday, April 23, 2008 6:35 AM by Roman Zdebskiy [MSFT]

# WPF Virtualization - Основы

Возможности WPF по виртуализации визуального дерева вашего интерфейса.

Wednesday, September 24, 2008 4:52 AM by RomanLerman

# re: Virtualized WPF Canvas

It's great control. But when it shows grid with many items, scrolling is very slow. How can it be improved?  

Sorry for my English.

Wednesday, May 13, 2009 2:14 PM by Corne_Kruger

# Virtualized WPF Canvas in a ListBoxItemTemplate

This works GREAT!!! But was wondering how I would go about adding items to it when it is used to override a Listbox's Style like this:

<Style TargetType="{x:Type ListBox}">

   <Setter Property="ItemsPanel">

        <Setter.Value>

             <ItemsPanelTemplate>

                  <VirtualCanvas Background="Transparent"/>

             </ItemsPanelTemplate>

        </Setter.Value>

   </Setter>

</Style>

Anonymous comments are disabled
 
Page view tracker