title: ComboBox column in WPF DataGrid with DataTable as ItemsSource
body: <p>I've got a datagrid bound to a datatable, with a ComboBoxColumn.  The XAML for this column is as follows:</p>
  
  <pre><code>&lt;DataGridComboBoxColumn Header="Rep Name" SortMemberPath="RepName" 
                        ItemsSource="{Binding UpdateSourceTrigger=PropertyChanged, Source={StaticResource EmployeeList}, Path=Employees}"
                        SelectedValueBinding="{Binding Mode=TwoWay, Path=EmpId}"
                        SelectedValuePath="EmpId" DisplayMemberPath="RepName" /&gt;
  </code></pre>
  
  <p><br>My Employees class:</p>
  
  <pre><code>public class EmployeeList : INotifyPropertyChanged
      {
          private ObservableCollection&lt;Employee&gt; _employees = new ObservableCollection&lt;Employee&gt;();
  
          public EmployeeList()
          {
             ...
          }
  
          public ObservableCollection&lt;Employee&gt; Employees
          {
              get { return _employees; }
              set { _employees = value; NotifyPropertyChanged("Employees"); }
          }
  
          public event PropertyChangedEventHandler PropertyChanged;
  
          public void NotifyPropertyChanged(string propertyName)
          {
              if (PropertyChanged != null)
              {
                  PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
              }
          }
      }
  
      public class Employee : INotifyPropertyChanged
      {
          private int _id;
          public int EmpId
          {
              get { return _id; }
              set { _id = value; OnPropertyChanged("EmpId"); }
          }
  
          public string RepName { get; set; }
  
          public event PropertyChangedEventHandler PropertyChanged;
          private void OnPropertyChanged(string propertyName)
          {
              if (PropertyChanged != null)
                  PropertyChanged(this,
                      new System.ComponentModel.PropertyChangedEventArgs(propertyName));
          }
      }
  </code></pre>
  
  <p><br></p>
  
  <p>The DataTable serving as items source for the grid contains an "EmpId" column and a "RepName" column.  The combobox is populated with all my employees, and when I make a selection, it is reflected in the datatable.  However, when the screen loads, the currently assigned employee is not selected by default in the combobox.  I thought that the SelectedValueBinding property of the combobox would handle this... what am I doing wrong?</p>
  
  <p><br><b>Update for clarification:</b>
  <br>The datagrid is bound to a datatable which includes an EmployeeID column.  Let's assume that when the screen loads, there are three rows in the table with EmployeeIDs 1, 2, and 3.  I need the combobox column in the first row to have EmployeeID 1 selected, the second row to have EmployeeID 2 selected, and the third row to have EmployeeID 3 selected.</p>