Freigeben über


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.

VirtualCanvas.zip

Comments

  • Anonymous
    March 08, 2008
    PingBack from http://msdnrss.thecoderblogs.com/2008/03/09/performant-virtualized-wpf-canvas/

  • Anonymous
    March 09, 2008
    WPF nous fournit par défaut un 'VirtualizingStackPanel' qui nous permet de virtualiser les éléments graphiques

  • Anonymous
    March 25, 2008
    We sometimes hear concerns that WPF applications memory foot print is too large. This could be because

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

  • Anonymous
    September 23, 2008
    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.

  • Anonymous
    May 13, 2009
    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
    September 28, 2010
    What is the license on this code?

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

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

  • Anonymous
    March 28, 2014
    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?