title: adding rows programmatically to grid in WPF window
body: <p>I have a window with a button and a Grid in this window with rows and columns setup. I'm trying to create a button that when clicked will add another row to the Grid and then assign a user control to that row.</p>
  
  <p>I've found a bunch of ways to do this online to datagrids but nothing for adding a rowdefinition to a grid. Can anyone assist with the code for this?</p>
  
  <p>WPF so far:</p>
  
  <pre><code>&lt;DockPanel&gt;        
      &lt;Button DockPanel.Dock="Top"  Height="22" x:Name="AddRow" Click="AddRow_Click"&gt;
          &lt;TextBlock Text="Add Skill"/&gt;
      &lt;/Button&gt;
      &lt;Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch"&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Width="1"/&gt;
              &lt;ColumnDefinition Width="1"/&gt;
              &lt;ColumnDefinition Width="1"/&gt;
              &lt;ColumnDefinition Width="1"/&gt;
              &lt;ColumnDefinition Width="1"/&gt;
              &lt;ColumnDefinition Width="1"/&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="1"/&gt;  
          &lt;/Grid.RowDefinitions&gt;
      &lt;/Grid&gt;        
  &lt;/DockPanel&gt;
  </code></pre>