title: How to stretch Rectangle over Grid cell in XAML
body: <p>I need to add a rectangle in second row of the grid.
  I need rectangle to have width same as the width of Grid.</p>
  
  <p>But the problem is, width of grid is decided at runtime. If I try to access <code>Width</code> or <code>ActualWidth</code> at the back code, I get <code>NaN</code> or <code>0.0</code> respectively.</p>
  
  <p><code>ColumnSpan</code> and <code>Stretch</code> are not working either.
  Here is the code:</p>
  
  <pre><code>&lt;Grid x:Name="downloadPdfGrid"&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition Height="20"/&gt;
          &lt;RowDefinition Height ="Auto"/&gt;
      &lt;/Grid.RowDefinitions&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition Width="*"/&gt;
      &lt;/Grid.ColumnDefinitions&gt;
      &lt;Button x:Name="btn" Content="{Binding Button}" Visibility="Collapsed" Click="OnButtonClick" Grid.Row="0"/&gt;
      &lt;Rectangle x:Name="underlineRect" Stretch="UniformToFill" Height="2" Fill="White" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="1"/&gt;
  &lt;/Grid&gt;
  </code></pre>