title: Relative coordinates in DrawingBrush
body: <p>I am somewhat confused about how relative coordinates work in WPF, especially in scenarios with DrawingBrushes.</p>
  <p>Let's say I want to paint the background of a square area, which is flexible in it's size. I want to paint the background with a special &quot;shape&quot;, let's say a kind of &quot;T&quot; laying on the side, with the vertical stroke going through the middle of the area.
  Using relative coordinates (the size of the area is flexible), I came up with the following XAML:</p>
  <pre><code>&lt;Window x:Class=&quot;MainWindow&quot;
      xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
      xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
      Title=&quot;MainWindow&quot; Height=&quot;722&quot; Width=&quot;722&quot; UseLayoutRounding=&quot;True&quot;&gt;
  &lt;Window.Resources&gt;
     
      &lt;DrawingBrush x:Key=&quot;EdgeGrid&quot;&gt;
          &lt;DrawingBrush.Drawing&gt;
              &lt;GeometryDrawing&gt;
                  &lt;GeometryDrawing.Geometry&gt;
                      &lt;!-- draw a single T laying on the side --&gt;
                      &lt;GeometryGroup&gt;
                          &lt;!-- top to bottom --&gt;
                          &lt;LineGeometry StartPoint=&quot;0.5,0.0&quot; EndPoint=&quot;0.5,1&quot;/&gt;
                          &lt;!-- left to right --&gt;
                          &lt;LineGeometry StartPoint=&quot;0.5,0.5&quot; EndPoint=&quot;1,0.5&quot;/&gt;
                      &lt;/GeometryGroup&gt;
                  &lt;/GeometryDrawing.Geometry&gt;
                  &lt;GeometryDrawing.Pen&gt;
                      &lt;Pen Thickness=&quot;0.01&quot; Brush=&quot;Black&quot; /&gt;
                  &lt;/GeometryDrawing.Pen&gt;
              &lt;/GeometryDrawing&gt;
          &lt;/DrawingBrush.Drawing&gt;
      &lt;/DrawingBrush&gt;
  &lt;/Window.Resources&gt;      
      &lt;Grid Name=&quot;LayoutRoot&quot;&gt;
      &lt;Rectangle Width=&quot;400&quot; Height=&quot;400&quot; Stroke=&quot;Black&quot; StrokeThickness=&quot;1&quot; Fill=&quot;{StaticResource EdgeGrid}&quot;&gt;
      &lt;/Rectangle&gt;
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p>But the result I get looks like this:</p>
  <p><a href="https://i.stack.imgur.com/Ppc6x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ppc6x.png" alt="Output" /></a><br />
  <sub>(source: <a href="http://www.bilder-hochladen.net/files/big/jf1u-1p-29ec.png" rel="nofollow noreferrer">bilder-hochladen.net</a>)</sub></p>
  <p>Shouldn't the vertical stroke go right through the middle (X coordinate is 0.5)?
  And also how can I set the pen thickness to be 1 or 2 pixels in relative mode?
  Any ideas?</p>