title: Docking the buttons at the bottom
body: <p>I am trying to dock the 2 buttons at the bottom of the window, so that they are always there when I resize the window. Obviously I am doing it wrong since it won't work. Here is my code. I have also seen from examples that some people uses the DockPanel.Dock on the controls and not the container itself. I can't do this for some reason. Using DockPanel.dock on the button gives an error.</p>
  
  <p>My question is: How do I make the buttons (Or the stackPanel) dock at bottom?</p>
  
  <pre><code>&lt;Window x:Class="MeditCal.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="MainWindow" Height="350" Width="525"&gt;
  &lt;DockPanel LastChildFill="True"&gt;
      &lt;StackPanel DockPanel.Dock="Top"&gt;      
          &lt;Grid&gt;                              
              &lt;Grid.RowDefinitions&gt;
                  &lt;RowDefinition Height="auto" /&gt;
                  &lt;RowDefinition Height="auto" /&gt;
                  &lt;RowDefinition Height="auto" /&gt;
                  &lt;RowDefinition Height="auto" /&gt;
                  &lt;RowDefinition Height="auto" /&gt;                                       
              &lt;/Grid.RowDefinitions&gt;                
  
             &lt;Label Grid.Row="0"&gt;Date&lt;/Label&gt;
             &lt;TextBox Grid.Row="1" Name="DateTxtBox" Background="WhiteSmoke"/&gt;
              &lt;Label Grid.Row="2"&gt;Note&lt;/Label&gt;
             &lt;TextBox Grid.Row="3" Name="noteTxtBox" 
                      Background="WhiteSmoke"&gt;&lt;/TextBox&gt;               
          &lt;/Grid&gt;
          &lt;Popup Height="100" Width="100" Name="popUpWin" StaysOpen="false" 
                 AllowsTransparency="True" 
                 HorizontalAlignment="Center" PopupAnimation="Fade"&gt;
              &lt;Border BorderThickness="1" Background="AliceBlue"&gt;
                  &lt;StackPanel Orientation="Horizontal"&gt;
                      &lt;TextBlock Text="Record added" /&gt;
                  &lt;/StackPanel&gt;
              &lt;/Border&gt;
          &lt;/Popup&gt;
          &lt;ListView Name="msgArea" Background="WhiteSmoke" MinHeight="150" 
                    Height="138"  /&gt;            
      &lt;/StackPanel&gt;        
  
      &lt;DockPanel LastChildFill="True"&gt;
          &lt;StackPanel DockPanel.Dock="Bottom"&gt;
              &lt;Grid&gt;
                  &lt;Grid.RowDefinitions&gt;
                      &lt;RowDefinition Height="auto" /&gt;
                  &lt;/Grid.RowDefinitions&gt;
  
                  &lt;Grid.ColumnDefinitions&gt;
                      &lt;ColumnDefinition Width="*" /&gt;
                      &lt;ColumnDefinition Width="*" /&gt;
                  &lt;/Grid.ColumnDefinitions&gt;
  
                  &lt;Button Name="addButton" Content="Add" Grid.Column="0" 
                          Grid.Row="1" /&gt;
                  &lt;Button Name="getRecordsButton" Content="Get records" 
                          Grid.Column="1" /&gt;
              &lt;/Grid&gt;
  
          &lt;/StackPanel&gt;
      &lt;/DockPanel&gt;
  &lt;/DockPanel&gt;
  </code></pre>
  
  <p></p>