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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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).