开发者

How to optimize performance for a canvas with hundreds of separate custom user controls

I am writing an application that can potentially have hundreds of custom user controls on a canvas. All of them can be dragged around the screen, and there are lines connecting all of then to at least one other user control. Once you reach 250 custom user controls开发者_开发技巧 or so performance starts to markedly decline, with frame rates going to 10 or below.

Are there any best practices or ideas on how to optimize performance in this sort of situation? The problem seems to be in the sheer number of controls on the canvas at any one time.

Thanks!

~Steve


Unfortunately no...it becomes a system resourcing issue.

One way to alleaviate this issue is using virtualization in some form or another as was done with the VirtualizingStackPanel. This boils down to removing items from the visual tree and holding a reference to the needed item once it needs to become visible. Not forcing the item to render will significantly reduce the needed system resources. If all the items need to be rendered at a given time it becomes a system resourcing issue at that point. Keep the control as small as possible and keep things such as anotmation to a minimum as they are taxing on the system.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜