title: WPF bind data grid combo box column programmatically to itemsource
body: <p>In my <code>datagrid</code>, one of columns is <code>DataGridComboBoxColumn</code>, where I'm trying to display different drop  down menu in every row. Easy task when creating combo box in XAML instead of doing it programatically. My problem is that I have no idea how to bind it properly. This is what I tried:</p>
  
  <pre><code>private DataGridComboBoxColumn CreateComboValueColumn(List&lt;Elements&gt; elements)
  {
      DataGridComboBoxColumn column = new DataGridComboBoxColumn();
      column.ItemsSource = elements;
      column.DisplayMemberPath = "Text";
      column.SelectedValuePath = "ID";
      column.SelectedValueBinding = new Binding("Value");
      return column;
  }
  
  public class Elements
  {
      public string Name { get; set; }
      public string Value { get; set; }
      public string Comment { get; set; }
      public List&lt;ComboItem&gt; ComboItems { get; set; }
  }
  
  public class ComboItem
  {
      public string ID { get; set; }
      public string Text { get; set; }
  }
  </code></pre>