title: How to set width to 100% in WPF
body: <p>Is there any way how to tell component in <strong>WPF</strong> to take 100% of available space?  </p>
  
  <p>Like  </p>
  
  <pre><code>width: 100%;  
  </code></pre>
  
  <p>in CSS </p>
  
  <p>I've got this XAML, and I don't know how to force Grid to take 100% width.</p>
  
  <pre><code>&lt;ListBox Name="lstConnections"&gt;
    &lt;ListBox.ItemTemplate&gt;
      &lt;DataTemplate&gt;
        &lt;Grid Background="LightPink"&gt;
          &lt;Grid.ColumnDefinitions&gt;
            &lt;ColumnDefinition Width="Auto"/&gt;
            &lt;ColumnDefinition Width="Auto"/&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;Grid.RowDefinitions&gt;
            &lt;RowDefinition Height="Auto"/&gt;
            &lt;RowDefinition Height="Auto"/&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Path=User}" Margin="4"&gt;&lt;/TextBlock&gt;
          &lt;TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=Password}" Margin="4"&gt;&lt;/TextBlock&gt;
          &lt;TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding Path=Host}" Margin="4"&gt;&lt;/TextBlock&gt;
        &lt;/Grid&gt;
      &lt;/DataTemplate&gt;
    &lt;/ListBox.ItemTemplate&gt;
  &lt;/ListBox&gt;
  </code></pre>
  
  <p>Result looks like  </p>
  
  <p><a href="http://foto.darth.cz/pictures/wpf_width.jpg">alt text http://foto.darth.cz/pictures/wpf_width.jpg</a></p>
  
  <p>I made it pink so it's obvious how much space does it take. I need to make the pink grid 100% width.</p>