Question

I have my main window at something like 6000 x 6000 px. In that window, I can have a lot of controls (more than 5000) and we can zoom/pan where we want.

I added 10 "television screens" controls in my application, and each of them have a refresh rate of 100ms. When I start this, everything crash...

10 objects with a refresh rate of 100ms each is too much, WPF cannot draw them at the time. I conclude that WPF is very slow to draw what I have....

Everything is drawn in vector, but I tried to add .CacheMode on them and it doesn't work either..

What can I do?

P.S. My PC is 8 core, 8 GB Ram, 256 Mb video card (nvidia quadro nvs 295) on win7 64bits

Was it helpful?

Solution

Work on reducing the number of controls in your application. 5K is quite a bit, and I think there is probably a way to reduce that number.

For example, use TextBlocks instead of Labels as TextBlocks render as 1 control while Labels render as 3 in 4.0 (I think its more than 3 in older versions)

Also, check and see if you can use UI Virtualization with some of your controls. Something like a ListBox of 100 items can be virtualized to only render 10 of them at a time.

OTHER TIPS

WPF uses software rendering in case you exceed maximum supported resolution of you graphics adapter. Moreover, 5k controls! Incredible. WPF is not a silver bullet for everything you imagine. You need to redesign your app or change technology you're using.

Take a look at ZoomableCanvas - 1 million items. This is the best example out there of what WPF can do when using every optimisation in the book. I suggest you take that example and run it at the maximum resolution on your monitors. If that fails to perform well, then WPF cannot do this.

I was unaware that WPF default to software rendering if the resolution exceeds that of the video card. A good caveat to know about!

Regarding high performance graphical APIs I second Keiren and say use DirectX (SlimDX provides a managed wrapper) instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top