title: Dock Controls in WPF
body: <p>I'm very new to WPF but I'm used to winforms. In winforms when I want to dock a control I just use <code>DockStyle</code> but I don't know how to do it in wpf. From the answer to <a href="https://stackoverflow.com/questions/3216020/how-to-use-dockstyle-fill-for-standard-controls-in-wpf">this question</a>, I have been able to dock my richtextbox in the window.</p>
  
  <p>But my problem now is how to dock my status bar and menustrip at the top and bottom of the window. I have tried using</p>
  
  <pre><code>&lt;Window x:Class="Textpad.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="Textpad" Height="324" Width="390" FontFamily="Tahoma"&gt;
  &lt;Grid&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition Width="368*" /&gt;
          &lt;ColumnDefinition Width="0*" /&gt;
      &lt;/Grid.ColumnDefinitions&gt;
      &lt;Menu Height="23" HorizontalAlignment="Center" Name="menu1" VerticalAlignment="Top" Width="368" Grid.ColumnSpan="2"&gt;
          &lt;MenuItem Header="File"&gt;
              &lt;MenuItem Header="New" /&gt;
              &lt;MenuItem Header="Open" /&gt;
              &lt;MenuItem Header="Save" /&gt;
              &lt;MenuItem Header="Save as" /&gt;
              &lt;Separator /&gt;
              &lt;MenuItem Header="Print" /&gt;
              &lt;MenuItem Header="Print Preview" /&gt;
              &lt;MenuItem Header="Page Setup" /&gt;
              &lt;Separator /&gt;
              &lt;MenuItem Header="Exit" /&gt;
          &lt;/MenuItem&gt;
          &lt;MenuItem Header="Edit"&gt;
              &lt;MenuItem Header="Undo" /&gt;
              &lt;MenuItem Header="Redo" /&gt;
              &lt;Separator /&gt;
              &lt;MenuItem Header="Cut" /&gt;
              &lt;MenuItem Header="Copy" /&gt;
              &lt;MenuItem Header="Paste" /&gt;
              &lt;MenuItem Header="Delete" /&gt;
              &lt;Separator /&gt;
              &lt;MenuItem Header="Find" /&gt;
              &lt;MenuItem Header="Replace" /&gt;
              &lt;Separator /&gt;
              &lt;MenuItem Header="Select All" /&gt;
          &lt;/MenuItem&gt;
          &lt;MenuItem Header="Format"&gt;
              &lt;MenuItem Header="Word Wrap" /&gt;
              &lt;Separator /&gt;
              &lt;MenuItem Header="Font" /&gt;
              &lt;MenuItem Header="Text Color" /&gt;
          &lt;/MenuItem&gt;
          &lt;MenuItem Header="View"&gt;
              &lt;MenuItem Header="Status Bar" /&gt;
          &lt;/MenuItem&gt;
          &lt;MenuItem Header="Help"&gt;
              &lt;MenuItem Header="About Textpad" /&gt;
          &lt;/MenuItem&gt;
      &lt;/Menu&gt;
      &lt;DockPanel&gt;
          &lt;StatusBar Height="23 " HorizontalAlignment="Stretch" Name="statusBar1" Width="368" Grid.ColumnSpan="2" DockPanel.Dock="Bottom"&gt;
              &lt;StatusBarItem Content="This is status baritem content to test" /&gt;
          &lt;/StatusBar&gt;
      &lt;/DockPanel&gt;
      &lt;RichTextBox HorizontalAlignment="Stretch" Margin="0,21" Name="richTextBox1" VerticalAlignment="Stretch" TextChanged="richTextBox1_TextChanged" VerticalContentAlignment="Top" Grid.ColumnSpan="2" /&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>But the menu and status bar are docked at the center of the window when maximised.</p>
  
  <p>Please what am i doing wrong?</p>