title: C#, WPF, Autorezise Listbox when window resize
body: <p>C#, Visual Studio 2010, dot net 4, WPF, Microsoft Ribbon</p>
  
  <p>I have a WPF window with the ribbon menues at the top of the window and an area below 
  where I try to fill with my controls however I can not get the controls to rezise with 
  my window.</p>
  
  <p>The listbox in the below example should be fully "expanded" witin its boundaries when the window appear and its width should follow the window width when the user resize the window 
  (the user should not resize the controls itself) by dragging i nthe windows sides.</p>
  
  <p>I tried a lot of playing around with the controls and searched the web but have not been able to 
  find a solution (some site indicated the usage of border would do the trick).</p>
  
  <p>The <code>Image image1</code> is a background image spanning over the whole "surface".
  The <code>Image image2</code> is a small logo picture.</p>
  
  <pre><code>&lt;DockPanel DockPanel.Dock="Top"&gt;
      &lt;Grid DockPanel.Dock="Top" Height="526" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="2"  Name="BaseGrid"&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Width="*" /&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="1" /&gt;
              &lt;RowDefinition Height="60" /&gt;
              &lt;RowDefinition Height="*" /&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;Image Grid.Column="0" Grid.Row="0" Grid.RowSpan="3" HorizontalAlignment="Left" Name="image1" VerticalAlignment="Top" Source="........./el_bg.jpg" Stretch="None" /&gt;
          &lt;Grid  Grid.Column="0" Grid.Row="1" VerticalAlignment="Top" Margin="2" HorizontalAlignment="Left"&gt;
              &lt;Grid.ColumnDefinitions&gt;
                  &lt;ColumnDefinition Width="200" /&gt;
                  &lt;ColumnDefinition Width="100" /&gt;
                  &lt;ColumnDefinition Width="*" /&gt;
              &lt;/Grid.ColumnDefinitions&gt;
              &lt;Grid.RowDefinitions&gt;
                  &lt;RowDefinition Height="50" /&gt;
              &lt;/Grid.RowDefinitions&gt;
              &lt;Image  Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Name="image2" Stretch="Fill" VerticalAlignment="Top" Source="........./shiny_rgb.png" /&gt;
              &lt;ListBox Grid.Column="2" Grid.Row="0" Name="MessageToUser" VerticalAlignment="Top" /&gt;
          &lt;/Grid&gt;
      &lt;/Grid&gt;
  &lt;/DockPanel&gt;
  </code></pre>
  
  <p>Regards</p>