title: C# WPF DataGrid.ItemsSource generates new Columns
body: <p>I use a DataTable as source for my DataGrid:  </p>
  
  <pre><code>  dt.Columns.Add("Update?", typeof(Boolean));
    dt.Columns.Add("Emulator", typeof(String));
    dt.Columns.Add("Path", typeof(String));
  
    ...      
  
    dataGrid1.ItemsSource = dt.DefaultView;
  </code></pre>
  
  <p>The XAML code to the DataGrid:</p>
  
  <pre><code>     &lt;DataGrid  AutoGenerateColumns="True" Height="133" HorizontalAlignment="Left" Margin="0,81,0,0" Name="dataGrid1" VerticalAlignment="Top" Width="688"  &gt;
          &lt;DataGrid.Columns&gt;
              &lt;DataGridCheckBoxColumn CanUserResize="False" Header="Update?" /&gt;
              &lt;DataGridTextColumn CanUserResize="False" Header="Emulator" IsReadOnly="False"/&gt;
              &lt;DataGridTextColumn CanUserResize="False" Header="Path" IsReadOnly="False"/&gt;
          &lt;/DataGrid.Columns&gt;
      &lt;/DataGrid&gt;
  </code></pre>
  
  <p>So if the DataTable is empty I got an empty DataGrid showing the three headers names.<br>
  If the DataTable contains items the DataGrid gets extra columns instead of filling the already existing ones.</p>
  
  <p><img src="https://i.stack.imgur.com/OkN7p.jpg" alt="enter image description here"></p>
  
  <p>What can I do that the DataGrid fills up its existing columns?</p>