title: WPF binding comboboxes to parent- child model
body: <p>I've got a model with a few tiers in it - something along the lines of ...</p>
  
  <p>Company > Employees > Phone numbers</p>
  
  <p>So I've got a <code>ListBox</code> showing all the companys in the model. Each <code>ListBoxItem</code> then contains two comboboxes ... one for employees, one for phone numbers.</p>
  
  <p>I can successfully get the employee combo to bind correctly and show the right people, but I'd like the phone combo to show the numbers for the selected employee.</p>
  
  <p>I'm just setting the <code>DataContext</code> of the <code>ListBox</code> to the model above and using the following data template for each item</p>
  
  <pre><code>  &lt;DataTemplate x:Key="CompanyBody"&gt;
          &lt;StackPanel Orientation="Horizontal"&gt;
  
              &lt;Label Content="{Binding Path=CompanyName}"&gt;&lt;/Label&gt;
              &lt;ComboBox Name="EmployeesCombo" ItemsSource="{Binding Path=Company.Employees}"&gt;&lt;/ComboBox&gt;
  
              &lt;!-- What goes here --&gt;
              &lt;ComboBox DataContext="???" ItemsSource="??" &gt;&lt;/ComboBox&gt;
  
          &lt;/StackPanel&gt;
      &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>I've tried (naively)</p>
  
  <pre><code> &lt;ComboBox ItemsSource="{Binding Path=Company.Employees.PhoneNumbers}" &gt;&lt;/ComboBox&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code> &lt;ComboBox DataContext="EmployeesCombo.SelectedValue" ItemsSource="{Binding Path=PhoneNumbers}" &gt;&lt;/ComboBox&gt;
  </code></pre>
  
  <p>and all other manner of combinations ...</p>