title: WPF - cascading ComboBoxes, dependent ones don't update
body: <p>I have three ComboBoxes such that C's items list is dependent on the selected item in B and B's items list is dependent on the selected item in A.  I have <code>ObservableCollection</code>s of particular classes for the <code>ItemsSource</code> on each ComboBox, and I want the <code>Name</code> property of the selected item to be pushed to a property in another class.  For example:</p>
  
  <pre><code>ObservableCollection&lt;AClass&gt; Items
  =&gt; ItemsSource of cbo_A ComboBox
  </code></pre>
  
  <p>And <code>selectedInstanceOfAClass.Name</code> should be pushed to <code>Data.AClassName</code> property.  The problem I have is that when I choose a value in the A ComboBox the first time, the B ComboBox gets the appropriate items based on the selected item in A, as expected.  Same for when I select an item in B for the first time--C gets the right items.  However, when I choose a different value in A, the items in B get updated but the selected value of B stays the same, and when I try to select a new value in B from its new items, the selection doesn't change--it stays the same selected value as what I initially selected in B.</p>
  
  <p>Here's the XAML I have right now:</p>
  
  <pre><code>&lt;ComboBox x:Name="cbo_A"
      ItemsSource="{Binding Path=Lists.AItems, Mode=OneWay}"
      DisplayMemberPath="Name" SelectedValuePath="Name"
      SelectedValue="{Binding Path=Data.AClassName, ValidatesOnDataErrors=True,
          Mode=OneWayToSource}" /&gt;
  
  &lt;ComboBox x:Name="cbo_B"
      ItemsSource="{Binding ElementName=cbo_A, Path=SelectedItem.BItems, Mode=OneWay}"
      SelectedValuePath="Name" DisplayMemberPath="Name"
      SelectedValue="{Binding Path=Data.BClassName, ValidatesOnDataErrors=True,
          Mode=OneWayToSource}"/&gt;
  
  &lt;ComboBox x:Name="cbo_C"
      ItemsSource="{Binding ElementName=cbo_B, Path=SelectedItem.CItems, Mode=OneWay}"
      SelectedValuePath="Name" DisplayMemberPath="Name"
      SelectedValue="{Binding Path=Data.CClassName, Mode=OneWayToSource,
          ValidatesOnDataErrors=True}" /&gt;
  </code></pre>
  
  <p>What is causing the weird behavior with the selected value not updating even when I explicitly click the ComboBox and try to change the value?</p>
  
  <p><strong>Edit:</strong> when debugging and I had a <code>SelectionChanged</code> handler on <code>cbo_A</code> and another on <code>cbo_B</code>, I entered the <code>cbo_B</code> handler before the <code>cbo_A</code> one, so the selected item from B's perspective was still the old item, because A had not been updated yet.  :/</p>
  
  <p><strong>Edit 2:</strong> if I flip the order of my ComboBoxes in XAML, suggested by <a href="https://stackoverflow.com/questions/606343/wpf-2-combobox-binding-problem">this question</a>, such that C comes before B comes before A, I enter A's handler first.  When I then enter the handler for <code>cbo_B</code>, the <code>SelectedItem</code> property shows the old value (previously selected, before I chose a new value in <code>cbo_A</code>), even though I clicked a value from the new list of items showing up in the ComboBox.</p>
  
  <p><strong>Edit 3:</strong> I'm trying a version of <a href="https://stackoverflow.com/questions/3005146/2-or-more-comboboxes-dependent-on-each-other/3005395#3005395">this answer</a> and getting the same problem:  I see new values in ComboBox B upon changing the selected value of ComboBox A, but I cannot change the selected value in B after I've already set it once.  I'm beginning to think I've got something else going awry.</p>