title: Simple WPF Custom Control - How to set background color?
body: <p>I've created the simplest possible WPF control - It just overrides OnRender and draws a red rectangle. </p>
  
  <p>However only when setting the Background in XAML to Blue, the control is all blue with no red showing.  If Background is not set, the red rectangle shows no problem. </p>
  
  <p><strong>How come the red rectangle is not displayed over the blue background when the background is set?</strong></p>
  
  <pre><code>public class MyWpfControl : Control
  {
      protected override void OnRender(DrawingContext drawingContext)
      {
          drawingContext.DrawRectangle(Brushes.Red, null, new Rect(0, 0, 100, 100));
      }
  }
  </code></pre>