title: Stretch Grid to window size
body: <p>I've just started learning C# WPF with a basic empty project and I want to make a grid, with a background image, which stretches exactly over the window.</p>
  
  <p>The way it is now, the grid stretches, but not the way I want it. For example my background image is 1000x1000px and my window size is 1700x1200px so the grid stretches to 1200x1200px (it keeps the aspect ratio of the image. I don't want this, I want it simply to stretch all over the window.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;Window x:Class="Backgammon.Window1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Window1" Height="auto" Width="auto"&gt;
  &lt;Grid VerticalAlignment="Stretch"&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition Width="auto" MinWidth="510" /&gt;
      &lt;/Grid.ColumnDefinitions&gt;
      &lt;Image Source="C:\Users\Edy\Pictures\cool-wallpapers1.jpg" Stretch="UniformToFill" HorizontalAlignment="Left"&gt;&lt;/Image&gt;
      &lt;Button Height="33" HorizontalAlignment="Right" Margin="0,0,12,12" Name="button1" VerticalAlignment="Bottom" Width="145" Click="button1_Click" ClipToBounds="False"&gt;Connect&lt;/Button&gt;
      &lt;ListBox Margin="12,12,0,149" Name="listBox1" HorizontalAlignment="Left" Width="225" /&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>Any help would be great, thanks.</p>