title: SelectedItem on ComboBox
body: <p>There is a <code>ComboBox</code> in the application which is bound to a collection of items. There are cases that user can select an item from the <code>ComboBox</code> but the selected item might not be ready yet so the <code>ComboBox</code> selected item must get back to the previous selected item (or some other item in the collection), but in the current application <code>ComboBox</code> always shows the selected item from the user instead of retrieving the valid item after setting it back and calling notify property change.</p>
  
  <p>The flowing is a simplified code of which shows the problem.</p>
  
  <pre><code>public partial class MainWindow : Window, INotifyPropertyChanged
  {
      private List&lt;Customer&gt; _Customers = new List&lt;Customer&gt;();
  
      public List&lt;string&gt; CustomerNames
      {
          get
          {
              var list = new List&lt;string&gt;();
              foreach (var c in _Customers)
              {
                  list.Add(c.Name);
              }
              return list; ;
          }
      }
  
      public string CustomerName
      {
          get
          {
              var customer = _Customers.Where(c =&gt; c.IsReady).FirstOrDefault();
              return customer.Name;
          }
          set
          {
              NotifyPropertyChanged("CustomerName");
          }
      }
  
      public MainWindow()
      {
          SetupCustomers();
          InitializeComponent();
          this.DataContext = this;
      }
  
      private void SetupCustomers()
      {
          _Customers.Add(new Customer("c1", true));
          _Customers.Add(new Customer("c2", false));
          _Customers.Add(new Customer("c3", false));
      }
  
      public event PropertyChangedEventHandler PropertyChanged;
  
      protected void NotifyPropertyChanged(string propertyName)
      {
          if (PropertyChanged != null)
              PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
      }
  }
  
  public class Customer
  {
      public Customer(string name, bool isReady)
      {
          this.Name = name;
          this.IsReady = isReady;
      }
  
      public bool IsReady { get; set; }
  
      public string Name { get; set; }
  
      public override bool Equals(object obj)
      {
          return base.Equals(obj);
      }
      public override int GetHashCode()
      {
          return base.GetHashCode();
      }
  }    
  
  
  &lt;Window x:Class="TryComboboxReset.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="MainWindow" Height="350" Width="525"&gt;
  &lt;Grid&gt;
  
      &lt;ComboBox   Width="100"
                  Height="25"
                  ItemsSource="{Binding Path=CustomerNames, Mode=OneWay}"
                  SelectedItem="{Binding Path=CustomerName, Mode=TwoWay}"/&gt;
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>