tags:

views:

407

answers:

2

I have a very simple WPF window - the only thing in it is a right-aligned button. When I resize the window by dragging the left boundary, the button jumps around - a lot. Try it yourself, drag the left boundary back and forth.

Additionally, a black background becomes exposed temporarily during resizes.

In this question, I asked a similar question about Windows Forms. The only answer I got suggested that this is fixed in WPF, however, amazingly, not only is it not fixed, but WPF also adds a second visual bug - the temporary black background.

Am I doing something wrong? How can I have my controls stay visually in one place during resizes? How can I avoid the black border?

Note: the button ends up in the correct place eventually - it only jumps around briefly during the resize.

A: 

I believe that the temporary black background is a WPF issue related to the fact that WPF uses DirectX as rendering mechanism, and when you resize the windows it has to synchronize drawing with the windowing system. This may also explain why the button is misplaced in relation to the window while dragging the window border. Drawing the non-client area of the window is much slower than drawing what's inside the window, and if you move the mouse fast on a slow computer the discrepancies between the border end the internals of the window will probably be more noticeable.

Supposedly this only happens on Vista with Aero enabled, and it should have been fixed in Vista SP1. However, I just tested on SP2, and I did still see a little bit of black background, but only when Aero was enabled. My graphics card is pretty fast so it was hardly noticeable.

If my analysis is correct the only way you can fix your problem is to getter a faster graphics card or turn off Aero.

Martin Liversage
Thanks, your suggestion may make this less noticeable but can't eliminate it altogether. The problem is not how long it's visible for, but that it's visible at all... By the way, the problem is also present in Win7 RTM.
romkyns
A: 

This doesn't seem to be possible in the current versions of WPF.

romkyns