title: XAML WinRT ComboBox Set SelectedItem
body: <p>I have a combo box that is bound to an ObservableList (observable list inherits from ObservableCollection). Here is my Carrier object:</p>
  
  <pre><code>public class Carrier
  {
      /// &lt;summary&gt;
      /// The carrier's name as it should be displayed to customers
      /// &lt;/summary&gt;
      public string Name { get; set; }
  
      /// &lt;summary&gt;
      /// This is the domain that email-to-text messages should be sent to. 
      /// &lt;/summary&gt;
      public string TextBase { get; set; }
  
      /// &lt;summary&gt;
      /// Unique identifier for carriers
      /// &lt;/summary&gt;
      public int CarrierId { get; set; }
  }
  </code></pre>
  
  <p>My problem is, in my ViewModel, I am trying to set the value of the selected item and it is not being set in the UI. When I choose an option from the combobox, it is correctly modifying my viewmodel, though (so I know the binding is working). </p>
  
  <p>Here is my xaml:</p>
  
  <pre><code>                &lt;ComboBox ItemsSource="{Binding ElementName=UserInformationPage, Path=DataContext.PhoneCarriers}" 
                        Style="{StaticResource ComboBox}"
                        Width="250"
                        DisplayMemberPath="Name"
                        SelectedItem="{Binding Path=SelectedCarrier, Mode=TwoWay}"
                        SelectedValuePath="CarrierId"
                        /&gt;
  </code></pre>
  
  <p>and here is my viewmodel:</p>
  
  <pre><code>    public Carrier SelectedCarrier
      {
          get { return _selectedCarrier != null ? PhoneCarriers.First(c =&gt; c.CarrierId == _selectedCarrier.CarrierId) : PhoneCarriers.First(); }
          set
          {
              if (_selectedCarrier == null || _selectedCarrier.CarrierId != value.CarrierId)
              {
                  Set(ref _selectedCarrier, value);
                  if (User != null)
                      User.Phone.Carrier = value;
              }
          }
      }
  
      public UserDemographicsViewModel()
      {
          MessengerInstance.Register&lt;SelectedUser&gt;(this, m =&gt;
          {
              User = m.User;
              CheckCanShowPassword();
              CheckCanResetPassword();
          });
  
          NavigationService.Navigated += (s, e) =&gt;
          {
              if (e.Parameter is User)
              {
                  User = e.Parameter as User;
                  if (User.Phone != null)
                  {
                      SelectedCarrier = User.Phone.Carrier;
                  }
              }
          };
  
          IsPasswordTextShown = false;
          TogglePasswordCommand = new RelayCommand(() =&gt; IsPasswordTextShown = !IsPasswordTextShown); //flip the state of password shown
          SaveUserCommand = new RelayCommand&lt;User&gt;(SaveUser, u =&gt; CanSaveUser());
          ResetPasswordCommand = new RelayCommand(TryResetPassword, () =&gt; User != null &amp;&amp; User.UserId != 0); //we have a user and its not a new user
  
  
  
          var repo = IoCContainer.GetContainer().Resolve&lt;IAccountRepository&gt;();
          var loggedInUser = App.Session.Get&lt;User&gt;("AuthenticatedUser");
          PhoneCarriers = new ObservableList&lt;Carrier&gt;(repo.GetPhoneCarriers(loggedInUser.AccountId));
  
      }
  </code></pre>
  
  <p>As I said, I know I am bound correctly to the SelectedCarrier property, but for some reason, the drop down is showing blank for the value when SelectedCarrier does match a value in the PhoneCarriers collection.</p>
  
  <p><strong>Update</strong></p>
  
  <p>I tried simplifying my SelectedCarrier property with the following:</p>
  
  <pre><code>    public Carrier SelectedCarrier
      {
          get { return _selectedCarrier; }
          set
          {
              if (_selectedCarrier == null || _selectedCarrier.CarrierId != value.CarrierId)
              {
                  _selectedCarrier = value;
                  RaisePropertyChanged("SelectedCarrier");
                  if (User != null)
                      User.Phone.Carrier = value;
              }
          }
      }
  </code></pre>
  
  <p>I know I have a selected carrier because, when debugging, if I change the dropdown value, I can see the value of _selectedCarrier before it is changed to the new value (and it hits the breakpoint fine). The value is just not displayed in the user interface.</p>