更新时间:2023-12-06 13:51:46
没有,没有办法强迫没有布局传递重新绘制。
由于WPF使用一个保留模式系统的OnRender()不工作像旧WinAPI的日子。的OnRender()只存储绘图指令的集合,和WPF决定如何以及何时做实际的渲染。
No, there is no way to force a re-render without a layout pass. Since WPF uses a retained mode system, OnRender() does not work like the old WinAPI days. OnRender() simply stores a collection of drawing instructions, and WPF determines how and when to do the actual rendering.
如果您需要independantly的改变控件的外观上浆,我建议你使用像一个DrawingVisual,并使用RenderOpen()当您希望它发生变化,添加您的mapDrawing。
If you need to change the look of your control independantly of sizing, I'd suggest you use something like a DrawingVisual, and using RenderOpen() to add your mapDrawing when you want it to change.