title: Cancel combobox selection in WPF with MVVM
body: <p>I've got a combobox in my WPF application:</p>
  
  <pre><code>&lt;ComboBox  ItemsSource="{Binding CompetitorBrands}" DisplayMemberPath="Value" 
     SelectedValuePath="Key" SelectedValue="{Binding Path=CompMfgBrandID, Mode=TwoWay,
     UpdateSourceTrigger=PropertyChanged}" Text="{Binding CompMFGText}"/&gt;
  </code></pre>
  
  <p>Bound to a collection of <code>KeyValuePair&lt;string, string&gt;</code></p>
  
  <p>Here is the CompMfgBrandID property in my ViewModel:</p>
  
  <pre><code>public string CompMfgBrandID
  {
      get { return _compMFG; }
      set
      {    
          if (StockToExchange != null &amp;&amp; StockToExchange.Where(x =&gt; !string.IsNullOrEmpty(x.EnteredPartNumber)).Count() &gt; 0)
          {
              var dr = MessageBox.Show("Changing the competitor manufacturer will remove all entered parts from the transaction.  Proceed?",
                  "Transaction Type", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
              if (dr != DialogResult.Yes)
                  return;
          }
  
          _compMFG = value;
          StockToExchange.Clear();
  
          ...a bunch of other functions that don't get called when you click 'No'...
          OnPropertyChanged("CompMfgBrandID");
      }
  }
  </code></pre>
  
  <p>If you choose "yes", it behaves as expected.  Items are cleared and the remaining functions are called.  If I choose 'No', it returns and doesn't clear my list or call any of the other functions, which is good, but the combobox still displays the new selection.  I need it to revert back to the original selection, as if nothing had changed, when the user picks 'No'.  How can I accomplish this?  I also tried adding <code>e.Handled = true</code> in codebehind, to no avail.</p>