title: WPF: Dynamical Label addition in Grid
body: <p>I have to create a <strong>table</strong> to display the KEY VALUE kind of thing.</p>
  
  <p>I tried the below code but messed up with <strong>overlapping output</strong>. I believe, I need to create the Grid RowDefinitions and ColumnDefinitions but not able to achieve it. Please help me.</p>
  
  <p>XAML:</p>
  
  <pre><code>&lt;Window x:Class="GrideLabel.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;Grid  Name="LabelGrid"&gt;&lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>Code behind:</p>
  
  <pre><code>    public partial class MainWindow : Window
      {
          public MainWindow()
          {
              InitializeComponent();
              AddLabelDynamically();
          }
  
          private void AddLabelDynamically()
          {
              for (int i = 0; i &lt; 3; i++)
              {
                  Label nameLabel = new Label(); nameLabel.Content = "KEY :"+i.ToString();
                  Label dataLabel = new Label(); dataLabel.Content = "VALUE :"+i.ToString();
                  //I want to creatre the Seperate coloum and row to  display KEY
                  // VALUE Pair distinctly
                  this.LabelGrid.Children.Add(nameLabel);
                  this.LabelGrid.Children.Add(dataLabel);
              }
          }
      }
  </code></pre>