ComboBox.SelectedValue not updating from binding source

We had a similar issue last week. It has to do with how SelectedValue updates its internals. What we found was if you set SelectedValue it would not see the change we had to instead set SelectedItem which would properly update every thing. My conclusion is that SelectedValue is designed for get operations and not set. But this may just be a bug in the current version of 3.5sp1 .net


To stir up a 2 year old conversation:

Another possibility, if you're wanting to use strings, is to bind it to the Text property of the combobox.

<ComboBox Text="{Binding Test}">
     <ComboBoxItem Content="A" />
     <ComboBoxItem Content="B" />
     <ComboBoxItem Content="C" />
</ComboBox>

That's bound to something like:

public class TestCode
{
    private string _test;
    public string Test 
    { 
      get { return _test; }
      set
      {
         _test = value;
         NotifyPropertyChanged(() => Test); // NotifyPropertyChanged("Test"); if not using Caliburn
      }
    }
}

The above code is Two-Way so if you set Test="B"; in code then the combobox will show 'B', and then if you select 'A' from the drop down then the bound property will reflect the change.