title: WPF drawing that stretches without stretching the Pen
body: <p>I need to draw some simple lines within a Border control (or similar) that always stretch to the bounds of the Border. Is there a way to stretch the lines only but not its pen? Without involving lots of C#?</p>
  
  <p>In this version the lines stretch:</p>
  
  <pre><code>&lt;Border&gt;
     &lt;Border.Background&gt;
        &lt;DrawingBrush&gt;
           &lt;DrawingBrush.Drawing&gt;
              &lt;DrawingGroup&gt;
                 &lt;GeometryDrawing Brush="Red"&gt;
                    &lt;GeometryDrawing.Geometry&gt;
                       &lt;GeometryGroup&gt;
                          &lt;RectangleGeometry Rect="0,0 100,1000" /&gt;
                          &lt;LineGeometry  StartPoint="0,0" EndPoint="100,1000"/&gt;
                          &lt;LineGeometry  StartPoint="100,0" EndPoint="0,1000"/&gt;
                       &lt;/GeometryGroup&gt;
                    &lt;/GeometryDrawing.Geometry&gt;
                    &lt;GeometryDrawing.Pen&gt;
                       &lt;Pen Thickness="20" Brush="Black"/&gt;
                    &lt;/GeometryDrawing.Pen&gt;
                 &lt;/GeometryDrawing&gt;
              &lt;/DrawingGroup&gt;
           &lt;/DrawingBrush.Drawing&gt;
        &lt;/DrawingBrush&gt;
     &lt;/Border.Background&gt;
  &lt;/Border&gt;
  </code></pre>
  
  <p>The best solution I have come up with is this:</p>
  
  <pre><code>&lt;Border&gt;
     &lt;Grid&gt;
        &lt;Path Stretch="Fill" Fill="Red" Stroke="Black" StrokeThickness="4"  Data="M0,0 L100,0 100,1000 0,1000 z" /&gt;
        &lt;Path Stretch="Fill" Stroke="Black" StrokeThickness="4"  Data="M 0,0 L0,0 100,1000" /&gt;
        &lt;Path Stretch="Fill" Stroke="Black" StrokeThickness="4"  Data="M 100,0 L100,0 0,1000" /&gt;
     &lt;/Grid&gt;
  &lt;/Border&gt;
  </code></pre>
  
  <p>But isn't there a better solution? That doesn't involve extra Grid?</p>