Reputation: 2618
I am developing a WPF app in which a lot of UI controls are being rendered at same time and it slows down animations, etc. Is there any way to prevent it?
Upvotes: 3
Views: 526
Reputation: 1896
Look at this article on WPF Performance tuning by Paul Harrington from VS2010 dev team. It has a number of useful tips on WPF performance and lists the tools these guys used.
Upvotes: 1
Reputation: 15772
Use virtualization wherever possible -
http://bea.stollnitz.com/blog/?p=338
http://bea.stollnitz.com/blog/?p=344
http://bea.stollnitz.com/blog/index.php?s=Virtualization+wpf
http://www.kirupa.com/net/ui_virtualization_pg1.htm
Upvotes: 0
Reputation: 6446
MSDN has some recommendations: msdn wpf perrformance
And also my favorite newbies Blog: Wpf Tutorial
Upvotes: 1
Reputation: 17612
Without knowing more about the specific way you're loading controls, it's hard to say. However, here's my hints and tips:
Don't use ObservableCollection unless you're actually changing the contents of the collection on the fly. If you can get away with a list, use that. We were using ObservableCollection like a bunch of newbies all over the place; changing this speeded up our application massively.
Don't call PropertyChanged unless the property really did change - compare with the previous property if you need to.
Consider the usability of the application. If showing that many controls at once is confusing to the PC, it's probably confusing to the user too. Can you hide some of them in an expander? Put them on different tabs? Is there a way to show less information which might make the app more intuitive?
Instrument the code / add some timed logging and check that it really is the rendering causing the problem. Then consider the calculations and relationships going on behind the scene (see the first two hints for the kind of stuff you can change).
Upvotes: 7
Reputation: 15968
Add fewer controls, use less animations, or get a better video card. :)
Upvotes: 0