我正在接管遗留 WPF 应用程序。 我注意到它偶尔会在启动时显示白屏。这不会一直发生。只有当我将鼠标移到屏幕上时,我才会开始看到绘制的 UI 部分。我从来没有绘制过整个 UI 并且必须重新启动应用程序。
我们在 windows 8.1 和 .net 4.5 上
抱歉,信息量最少,但提供有关查找位置的线索会很棒。
最佳答案
虽然实际上不知道代码在做什么,但看起来 WPF 渲染线程没有跟上,我建议您尝试一些事情:
- 在不同的机器/显卡上尝试这个,看看是否发生相同的行为
- 你能检查一下你的 CPU 是否在做大量工作吗?
- 检查您的内存力是否在不断增加?
- 分析应用程序(垃圾收集、生成大小等)
但是,最好是开始查看代码,这可能只是一个导致 UI 困惑的错误。
在此处查看一些故障排除提示
Windows Presentation Foundation (WPF) differs from prior application platforms on Windows in that it uses its own DirectX-based hardware-accelerated rendering pipeline, when available, to draw the contents of any WPF windows.Prior application platforms were typically much less dependent on display driver quality because the bulk of their rendering was done in software rather than hardware. As a result, the visual quality of WPF applications is heavily dependent on the quality of the system’s display device and its display drivers. Faulty display devices may cause drawing artifacts within WPF applications or elsewhere on the desktop when an application uses the WPF hardware-rendering pipeline.
关于c# - WPF白屏渲染问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40310645/