title: WPF C# DataGrid binding List with different types
body: <p>I have a problem binding a List to a DataGrid.</p>
  
  <p>What I want is to have a column presenting different types, such as:</p>
  
  <p>[Property 1] [String]</p>
  
  <p>[Property 2] [bool]</p>
  
  <p>[Property 3] [enum]</p>
  
  <p>My implementation looks like this:</p>
  
  <pre><code>public interface IPropertyItem 
  {
  }
  
  public class PropertyItem&lt;T&gt; : IPropertyItem
  {
      public String Name { get; set; }
      public T Value { get; set; }
  }
  </code></pre>
  
  <p>I create a List to store these properties:</p>
  
  <pre><code>List&lt;IPropertyItem&gt; PropertyList { get; set; }
  </code></pre>
  
  <p>And bind to the data grid:</p>
  
  <pre><code>dataGrid.ItemsSource = PropertyList;
  </code></pre>
  
  <p>The problem now is that all cells in the 2nd column presents the different datatypes as Text. </p>
  
  <p>But what I want is to have a checkbox for bools, combobox for enums etc.</p>
  
  <p>I would really appreciate any help with this. Been stuck with this issue for days now.</p>
  
  <p>Thank you!</p>
  
  <p>-- UPDATE --</p>
  
  <p>Adding a DataTemplateSelector solved the problem.</p>