title: GetAdornerLayer mysteriously returning null
body: <p>I've been using the same bit of code for several versions of my app with no problems, but I'm now mysteriously receiving <code>NullRerefenceException</code>s with the following:</p>
  
  <pre><code>this.Loaded += delegate {
      deleteBrush = new DeleteBrushAdorner( background );
      AdornerLayer al = AdornerLayer.GetAdornerLayer( background );
      al.Add( deleteBrush ); // null ref here??
  };
  </code></pre>
  
  <p><code>background</code> is just a <code>Border</code> element.</p>
  
  <p>My two thoughts on what could be causing it are a) switching to .NET 4.0, and b) placing instances of the above element (which is a <code>UserControl</code>) in an <code>ItemsControl</code>.</p>
  
  <p>Oddly this doesn't happen all the time, and it's hard to predict when it will happen, so it's not reliable.</p>