title: How to load a list into a ComboBox DataGrid and display selected value from another list?
body: <p><strong>Goal</strong></p>
  <p>I am aiming to achieve the following:</p>
  <ul>
  <li>Load Person List to DataGrid ✔️</li>
  <li>Load Positions List to DataGrid column into a ComboBox ✔️</li>
  <li>Set the Person's Position value to Position's ComboBox ❌</li>
  </ul>
  <p><strong>Visual Output</strong></p>
  <p><a href="https://i.stack.imgur.com/r8wl8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r8wl8.png" alt="enter image description here" /></a></p>
  <p><strong>Code...</strong></p>
  <p><strong>Models</strong></p>
  <p>I have 2 models</p>
  <pre><code>public class Person
  {
      public string Name { get; set; }
      public Position Position { get; set; }
  }
  
  public class Position
  {
      public int PositionId { get; set; }
      public string PositionTitle { get; set; }
  }
  </code></pre>
  <p><strong>View Model</strong></p>
  <pre><code>public class ViewModel : BaseViewModel
  {
      public ViewModel()
      {
          People = new ObservableCollection&lt;Person&gt;();
          People.Add(new Person { Name = &quot;Name 1&quot;, Position = new Position { PositionId = 1, PositionTitle = &quot;Position Title 1&quot; } });
          People.Add(new Person { Name = &quot;Name 2&quot;, Position = new Position { PositionId = 1, PositionTitle = &quot;Position Title 1&quot; } });
          People.Add(new Person { Name = &quot;Name 3&quot;, Position = new Position { PositionId = 2, PositionTitle = &quot;Position Title 2&quot; } });
  
          Positions = new ObservableCollection&lt;Position&gt;();
          Positions.Add(new Position { PositionId = 1, PositionTitle = &quot;Position Title 1&quot; });
          Positions.Add(new Position { PositionId = 2, PositionTitle = &quot;Position Title 2&quot; });
      }
  
      private ObservableCollection&lt;Person&gt; people;
  
      public ObservableCollection&lt;Person&gt; People
      {
          get { return people; }
          set
          {
              people = value;
              OnPropertyChanged();
          }
      }
  
      private ObservableCollection&lt;Position&gt; _positions;
  
      public ObservableCollection&lt;Position&gt; Positions
      {
          get { return _positions; }
          set
          {
              _positions = value;
              OnPropertyChanged();
          }
      }
  
  
  }
  
  public class Person
  {
      public string Name { get; set; }
      public Position Position { get; set; }
  }
  
  public class Position
  {
      public int PositionId { get; set; }
      public string PositionTitle { get; set; }
  }
  </code></pre>
  <p><strong>View</strong></p>
  <pre><code>&lt;DataGrid ItemsSource=&quot;{Binding People}&quot; AutoGenerateColumns=&quot;False&quot;&gt;
      &lt;DataGrid.Columns&gt;
          &lt;DataGridTextColumn Header=&quot;Name&quot; Binding=&quot;{Binding Name}&quot; /&gt;
          &lt;DataGridTemplateColumn Header=&quot;Position Title&quot;&gt;
              &lt;DataGridTemplateColumn.CellTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;ComboBox ItemsSource=&quot;{Binding Path=DataContext.Positions, RelativeSource={RelativeSource AncestorType=DataGrid}}&quot;
                                DisplayMemberPath=&quot;PositionTitle&quot;
                                SelectedValue=&quot;{Binding Path=Position}&quot; /&gt;
                  &lt;/DataTemplate&gt;
              &lt;/DataGridTemplateColumn.CellTemplate&gt;
          &lt;/DataGridTemplateColumn&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  <p><strong>Question</strong></p>
  <p>How do I set the SelectedItem/Index of Position to what the Person's Position is set to?</p>