title: stretch border to existing space
body: <p>I have this:</p>
  
  <pre><code>&lt;Border Background="Gray"&gt;
     &lt;TextBlock x:Name="Text" 
                Text="{Binding Name}" 
                Margin="0, 5" 
                FontSize="16"/&gt;
  &lt;/Border&gt;
  </code></pre>
  
  <p>It looks like this: (There are three of those)</p>
  
  <p><a href="https://i.stack.imgur.com/ZLvNr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZLvNr.png" alt="enter image description here"></a></p>
  
  <p>I want it to look like this:</p>
  
  <p><a href="https://i.stack.imgur.com/uhn5b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uhn5b.png" alt="enter image description here"></a></p>
  
  <p>(Border stretching to end of the space + some control over the height of the border.)</p>
  
  <h2>p.s. I do not have to use borders, anything that will achieve the same effect will do.</h2>
  
  <p><strong>update:</strong> This is part of a DataTemplate for a ListBoxItem. It's defined in a style like this:</p>
  
  <pre><code>&lt;Setter Property="ContentTemplate"&gt;
      &lt;Setter.Value&gt;
          &lt;DataTemplate&gt;
              &lt;Border&gt;
                  &lt;TextBlock x:Name="Text"
                         Text="{Binding Name}" 
                         Margin="0, 5" 
                         FontSize="16"/&gt;
              &lt;/Border&gt;
          &lt;/DataTemplate&gt;
      &lt;/Setter.Value&gt;
  &lt;/Setter&gt;
  </code></pre>
  
  <p>I tried to set the HorizontalAlignment to "Stretch" and it didn't work. Any ideas?</p>