title: How to fix the WPF form resize - controls lagging behind and black background?
body: <p>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.</p>
  
  <p>Additionally, a black background becomes exposed temporarily during resizes.</p>
  
  <p>In <a href="https://stackoverflow.com/questions/1333425/how-to-prevent-controls-visually-lagging-behind-on-resize-inside-tablelayoutpanel">this</a> 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.</p>
  
  <p>Here's what the control lag looks like; this occurs when I resize the window by its top border (recorded with a camera because screen-cap made it less obvious by making everything slow):</p>
  
  <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <img src="https://i.stack.imgur.com/R2sLZ.gif" alt="enter image description here"></p>
  
  <p>Example of the black border: this was captured while resizing the window; it's only like this for a split second but it's very noticeable:</p>
  
  <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <img src="https://i.stack.imgur.com/0ihm4.png" alt="enter image description here"></p>
  
  <p>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?</p>
  
  <p><strong>Note</strong>: the button ends up in the correct place <em>eventually</em> - it only jumps around <em>briefly</em> during the resize.</p>