WPF Performance and .NET Framework Client Profile

WPF performance and .NET Framework Client Profile related blogs provided by Jossef Goldberg.

Virtualized WPF Canvas

Virtualized WPF Canvas

  • Comments 10

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.

Attachment: VirtualCanvas.zip
Leave a Comment
  • Please add 4 and 7 and type the answer here:
  • Post
  • PingBack from http://msdnrss.thecoderblogs.com/2008/03/09/performant-virtualized-wpf-canvas/

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

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

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

  • 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.

  • 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>

  • What is the license on this code?

  • Hi dpruitt , you are welcome to use the provided code in your application. Be aware though that it was not thoroughly tested.  

    Jossef.

  • Its a great control. Do you have a same in Silverlight? else How to convert it into "Silverlight"?

  • Its great one. Can you please tell me how to do zooming the panning in this control?, or is there any other control to do this?

Page 1 of 1 (10 items)