title: wpf data grid create dynamically
body: <p>I am new to WPF control. I need the output as below attached image. The Below code is the output for WPF Grid. I would like to repeat the grid header for n no.of. times.  based on the date range selected by the user. 
  Any one please advise me how to achieve this dynamically
       
          
              
              
              
              
              
              
              
          
          
              
                  
              
          
          
              
                  
              
          
          
              
                  
                  
              
              
                  
              
              
                  
              
          </p>
  
  <pre><code>    &lt;Grid Grid.Row="3"&gt;
          &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Width="*" /&gt;
              &lt;ColumnDefinition Width="*" /&gt;
              &lt;ColumnDefinition Width="*" /&gt;
              &lt;ColumnDefinition Width="*" /&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;Border Grid.Column="0"&gt;
              &lt;TextBlock Grid.Column="1" Text="P2L3" TextAlignment="Center" /&gt;
          &lt;/Border&gt;
          &lt;Border Grid.Column="1"&gt;
              &lt;TextBlock Grid.Column="1" Text="P1L2" TextAlignment="Center" /&gt;
          &lt;/Border&gt;
          &lt;Border Grid.Column="2"&gt;
              &lt;TextBlock Grid.Column="1" Text="P2L3" TextAlignment="Center" /&gt;
          &lt;/Border&gt;
          &lt;Border Grid.Column="3"&gt;
              &lt;TextBlock Grid.Column="1" Text="P1L2" TextAlignment="Center" /&gt;
          &lt;/Border&gt;
      &lt;/Grid&gt;
      &lt;Grid Grid.Row="4"&gt;
          &lt;Grid.ColumnDefinitions &gt;
              &lt;ColumnDefinition Width="*" /&gt;
              &lt;ColumnDefinition Width="*" /&gt;
              &lt;ColumnDefinition Width="*" /&gt;
              &lt;ColumnDefinition Width="*" /&gt;
          &lt;/Grid.ColumnDefinitions&gt;
          &lt;Border Grid.Column="0"&gt;
              &lt;TextBlock Grid.Column="1" Text="GEN3" TextAlignment="Center" /&gt;
          &lt;/Border&gt;
          &lt;Border Grid.Column="1"&gt;
              &lt;TextBlock Grid.Column="1" Text="GEN3" TextAlignment="Center" /&gt;
          &lt;/Border&gt;
          &lt;Border Grid.Column="2"&gt;
              &lt;TextBlock Grid.Column="1" Text="GEN3" TextAlignment="Center" /&gt;
          &lt;/Border&gt;
          &lt;Border Grid.Column="3"&gt;
              &lt;TextBlock Grid.Column="1" Text="GEN3" TextAlignment="Center" /&gt;
         &lt;/Border&gt;          
      &lt;/Grid&gt;
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/lJTH4.png" alt="enter image description here"></p>
  
  <blockquote>
    <p>Can any advise me to write it dynamically and the output will repeat for n times using code.
    i.e the same header is changed by date.
    My Final out put will be as below
    <img src="https://i.stack.imgur.com/1eOcb.png" alt="enter image description here"></p>
  </blockquote>