如何WPF优化布局/渲染周期? [英] How does WPF optimise the layout / rendering cycle?

查看:350
本文介绍了如何WPF优化布局/渲染周期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何WPF优化布局/渲染周期在变幻莫测的应用程序?

例如,假设我在临门自定义控件无效两次,将它渲染的两倍?是否存在性能问题时,数据/属性更新速率比主渲染速度更快?

For example, imagine I invalidate a custom control twice in quick succession, will it render twice? Are there performance issues when Data/Property update-rates are faster than main render rate?

推荐答案

根据我的经验,我可以说,没有也不会渲染两次,如果它的快速足够多的。 我不是100%肯定,但是这就是为什么我认为这样的:

Based on my experience, I can say that no it will no render twice if it's fast enought. I'm not 100% sure, but this is why i think this:

我们有一个非常大的应用程序(千控制),它是一个飞机驾驶舱,所有的WPF中,每个按钮,开关,屏幕是可移动的用手势,或鼠标。

We had a really heavy application (thousands of controls), it was an aircraft cockpit, all in wpf, each button, switch, screen were movable by gesture, or mouse.

驾驶舱为10万像素10万像素,并实施了放大/缩小(鼠标滚轮),平移时,鼠标右键点击。

The cockpit was 10 000 pixels by 10 000 pixels, and implemented a Zoom in/Zoom out (with mouse wheel), panning when right mouse button clicked.

优化前,这是非常laggy,速度慢,所以每个放大步骤,即潘步骤所花约1秒

Before optimization, it was very laggy, slow, so each "Zoom" step, or "Pan" step took about 1 second

如果我放大1倍(变焦* 1.2为例),它花费了1秒钟

If I Zoom 1 time (Zoom * 1.2 for example), it took 1 second

如果我放大10倍(变焦* 1.2×10),它并不需要10秒,它需要大概如2秒,这取决于您滚动的速度,它不呈现每个缩放一步只有它渲染最后一...

If I Zoom 10 times (Zoom * 1.2 X 10), it does not takes 10 seconds, it takes probably like 2 seconds depending on the speed you scroll, and it does not render each "zoom step" it render only the last one...

这篇关于如何WPF优化布局/渲染周期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆