title: C# WPF - Databinding DataGridComboboxColumn SelectedValueBinding
body: <p>I´m trying to bind Data to a DataGridComboBoxColumn.</p>
  
  <p>I already managed to bind the ItemsSource, but the bound value won´t be selected, instead the ComboBox has just nothing selected.</p>
  
  <p>DataGrid:</p>
  
  <pre><code>&lt;DataGrid x:Name="dg" ItemsSource="{Binding}" AutoGenerateColumns="false"&gt;
      &lt;DataGrid.Columns&gt;
          &lt;DataGridComboBoxColumn Header="Name" SelectedValueBinding="{Binding name}" ItemsSource="{Binding Source={x:Static K:Material.loadedMaterials}}" DisplayMemberPath="name"/&gt;
          &lt;DataGridTextColumn Header="Name2" Binding="{Binding name}"/&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>Material-Class:</p>
  
  <pre><code>public class Material {
      public static List&lt;Material&gt; loadedMaterials;
  
      static Material() {
          loadedMaterials = new List&lt;Material&gt;();
  
          loadedMaterials.Add(new Material("TEST1", "", ""));
          loadedMaterials.Add(new Material("TEST2", "", ""));
          loadedMaterials.Add(new Material("TEST3", "", ""));
      }
  
      public string name { get; set; }
      public string name2 { get; set; }
      public string name3 { get; set; }
  
      public Material(string n, string n2, string n3) {
          name = n;
          name2 = n2;
          name3 = n3;
      }
  }
  </code></pre>
  
  <p>Main Window:</p>
  
  <pre><code>public partial class MainWindow : Window {
      public System.Collections.ObjectModel.ObservableCollection&lt;Material&gt; mat;
  
      public MainWindow() {
          InitializeComponent();
  
          mat = new System.Collections.ObjectModel.ObservableCollection&lt;Material&gt;();
          mat.Add(new Material("TEST1", "TEST1", "TEST1"));
  
          dg.DataContext = mat;
      }
  }
  </code></pre>
  
  <p>As you can see here, the DropDown is loaded and the Textbox, which has the same data bound, shows it correctly, but the ComboBox is empty.</p>
  
  <p>I´m excpecting <code>TEST1</code> to be selected and displayed in the ComboBox.</p>
  
  <p><a href="https://i.stack.imgur.com/952D6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/952D6.png" alt="enter image description here"></a></p>