How does WPF optimise the layout / rendering cycle?

前端 未结 1 1595
孤独总比滥情好
孤独总比滥情好 2021-02-14 02:06

How does WPF optimize the Layout / Rendering cycle in a highly volatile application?

For example, imagine I invalidate a custom control twice in quick

1条回答
  •  一生所求
    2021-02-14 02:24

    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:

    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.

    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.

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

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

    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...

    0 讨论(0)
提交回复
热议问题