title: set ItemTemplate for specific column of DataGrid
body: <p>I have a WPF <code>DataGrid</code> and it is bound to <code>List&lt;Person&gt; people</code>.</p>
  
  <pre><code>public class Person
  {
      public string Name{get;set;}
      public string LastName{get;set;}
      public string Address{get;set;}
      public int Age{get;set;}
  }
  
  public void ShowPeople()
  {
       myDataGrid.ItemsSource = people;
  }
  </code></pre>
  
  <p>It shows everything fine, but I want to show <code>Address</code> in <code>TextBox</code> inside the <code>DataGrid</code>.</p>
  
  <p>I changed XAML code to this:</p>
  
  <pre><code>   &lt;DataGrid x:Name="myDataGrid"&gt;
          &lt;DataGridTemplateColumn Header="Address"&gt;
              &lt;DataGridTemplateColumn.CellTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;TextBox Text="{Binding Path=Address}"/&gt;
                  &lt;/DataTemplate&gt;
              &lt;/DataGridTemplateColumn.CellTemplate&gt;
          &lt;/DataGridTemplateColumn&gt;
      &lt;/DataGrid&gt;
  </code></pre>
  
  <p>this is not working. It is giving me an error.</p>
  
  <blockquote>
    <p>Items collection must be empty before using ItemsSource.</p>
  </blockquote>
  
  <p>Please help.
  Thanks,</p>