title: Creating DataGrid's ComboBox dynamically in WPF
body: <p>I am creating a WPF <code>DataGrid</code> dynamically through code.
  One of the columns has to be of type <code>ComboBox</code></p>
  
  <pre><code>public class myModel
  {
      public  string[] item;
  }   
  
  var modelList = new List&lt;myModel&gt;();
  modelList.Add(new myModel {item = new string[] {"One", "Two", "Three"}});
  modelList.Add(new myModel {item = new string[] {"1", "2", "3"}});
  
  foreach (DataColumn col in myData.Columns)
  {
      if (col.ColumnName.Equals("Model"))
      {
          var binding = new Binding("modelList");
          binding.Source = modelList;
  
          myGrid.Columns.Add(new DataGridComboBoxColumn
          {
              Header = col.ColumnName,
              Width = 75,
              ItemsSource =modelList, //new string[] { "4", "5", "6" } &lt;-this only works!
              DisplayMemberPath = "item",
              SelectedItemBinding = binding,
              SelectedValuePath = "item"
          });
      }
  }
  </code></pre>
  
  <p>I have really no idea what's going on . All I have after this is an empty <code>ComboBox</code>.
  What I need is first combo to have <code>{"One", "Two", "Three"}</code>, 2nd combo <code>{"1", "2", "3"}</code> etc. I can't use  model behind this because the number of columns varies. <br> <br>How can I achieve this ?</p>