Improving WPF Canvas performance

Sam picture Sam · Sep 26, 2011 · Viewed 9.8k times · Source

I am developing a Maps like application using WPF. I have ~10,000 PathGeometry, Shapes added to the canvas. I have added ScaleTransform and TranslateTransform for zooming and panning controls.

The problem I'm facing is, when I zoom or pan, there is slight lag. Is there a way to organize the data so that I handle only the Shapes that are visible?

Any hints on making it more efficient will be helpful and appreciated.

Answer

Simon Mourier picture Simon Mourier · Sep 26, 2011

I suggest you have a look at this interesting article, with the concept of Virtual Canvas: ZoomableApplication2: A Million Items. It also has a live (xbap) demo online.