Why is there a black lag every time a WPF window is resized?

Other questions at SE are how to speed up resizing of the nested user interface, but what if there are no controls?

When you drag the edge of a WPF window, even the main window with no content, the black bars instantly flicker while dragging. This leads to a painful sensation, which I do not want to cause clients:

WPF window being resized

It gets slower and heavier with a full user interface on top of it. This is not even related to how ugly it looks when resized using the top or left edges. Windows Forms - even with the heaviest user interface I built - never looks so bad right off the bat.

What can be done to make WPF window resizing comparable to winnings?

(I have Windows 7 x64 and a system with three monitors on an AT Radeon HD 7470.)

+6
source share
1 answer

You can update your graphics card and try it again, but that will not change anything. The reason is pretty simple. We all see that sometimes it depends on how fast / slower our computer works. Sometimes it works smoothly, because we do not have a large number of visual drawings. The reason is that the proper background color was not found on the graphics card at this point during the redrawing process. Your drivers are fine, not just because you are using Wpf. Other methods use the same mechanism for redrawing.

The first thing that WPF does is to clean up the dirty region that will be redrawn. The goal of dirty regions is to reduce the number of pixels sent to the merge phase of the GPU pipeline output. Here we see the black color. The window itself at this point does not have a background color or its background color is set to transparent, and therefore the GPU draws a black background for us. Things are done by async in wpf, which is good.

To fix this, you can set the color of the fix, such as "White" for the window. Then the WPF system will clear the dirty area, but will automatically fill it with white instead of black. This usually helps.

Match the color of the window or the color of the top layer. Do not let the GPU use black, and you should do everything. Btw Wpf is faster than WinForm, so don't worry.

+3
source

All Articles