title: My Combobox Selected Value binding doesn't flow back in Two Way Data binding
body: <p>Im Using Simple MVVM  Framework to create a simple Silverlight 4.0 LOB Application. </p>
  
  <p>I have an Employee List View that shows List Of all Employees in and i have in my EmployeeListViewModel some properties As Follow:</p>
  
  <pre><code>    private Grade selectedGrade;
      public Grade SelectedGrade
      {
          get { return selectedGrade; }
          set
          {
              selectedGrade = value;
              NotifyPropertyChanged(m =&gt; m.SelectedGrade);
          }
      }
  
      private Religion selectedReligion;
      public Religion SelectedReligion
      {
          get { return selectedReligion; }
          set
          {
              selectedReligion = value;
              NotifyPropertyChanged(m =&gt; m.SelectedReligion);
          }
      }
      private ObservableCollection&lt;Grade&gt; grades;
      public ObservableCollection&lt;Grade&gt; Grades
      {
          get { return grades; }
          set
          {
              grades = value;
              NotifyPropertyChanged(m =&gt; m.Grades);
          }
      }
  
      private ObservableCollection&lt;Religion&gt; religions;
      public ObservableCollection&lt;Religion&gt; Religions
      {
          get { return religions; }
          set
          {
              religions = value;
              NotifyPropertyChanged(m =&gt; m.Religions);
          }
      }
      private ObservableCollection&lt;Department&gt; departments;
      public ObservableCollection&lt;Department&gt; Departments
      {
          get { return departments; }
          set
          {
              departments = value;
              NotifyPropertyChanged(m =&gt; m.Departments);
          }
      }
      private Employee selectedEmployee;
      public Employee SelectedEmployee
      {
          get { return selectedEmployee; }
          set
          {
              selectedEmployee = value;
              SetCanProperties();
              NotifyPropertyChanged(m =&gt; m.SelectedEmployee);
          }
      }
      private ObservableCollection&lt;Employee&gt; employees;   
      public ObservableCollection&lt;Employee&gt; Employees
      {
          get { return employees; }
          set
          {
              employees = value;
              NotifyPropertyChanged(m =&gt; m.Employees);
          }
      }
      private Department selectedDepartment;
      public Department SelectedDepartment
      {
          get { return selectedDepartment; }
          set
          {
              selectedDepartment = value;
              NotifyPropertyChanged(m =&gt; m.SelectedDepartment);
          }
      }
  </code></pre>
  
  <p>now in my view i have a button to edit selected employee in my Employee List that opens up a new Child Window with the EmployeeDetails to Edit </p>
  
  <pre><code>  EmployeeListViewModel viewModel;
      public EmployeeListView()
      {
          InitializeComponent();
          viewModel = (EmployeeListViewModel)DataContext;
      }
  </code></pre>
  
  <p>and here is the edit employee Method </p>
  
  <pre><code> private void editItemButton_Click(object sender, RoutedEventArgs e)
      {
          // Exit if no product selected
          if (viewModel.SelectedEmployee == null) return;
  
          // Create a product detail model
         EmployeeDetailViewModel detailModel =
              new  EmployeeDetailViewModel(viewModel.SelectedEmployee);
          // set comboboxes !! 
  
         detailModel.Departments = viewModel.Departments;
         detailModel.Religions = viewModel.Religions;
  
         detailModel.Grades = viewModel.Grades;
  
          // Start editing
          detailModel.BeginEdit();
  
          // Show EmployeeDetail view
         EmployeeDetailView itemDetail = new  EmployeeDetailView(detailModel);
          itemDetail.Closed += (s, ea) =&gt;
          {
              if (itemDetail.DialogResult == true)
              {
                  // Confirm changes
  
                  detailModel.EndEdit();
              }
              else
              {
                  // Reject changes
                  detailModel.CancelEdit();
              }
          };
          itemDetail.Show();
      }
  </code></pre>
  
  <p>now on my details Child View I have this Constractor</p>
  
  <pre><code>   public EmployeeDetailView(EmployeeDetailViewModel viewModel)
      {
          InitializeComponent();
          DataContext = viewModel;
      }
  </code></pre>
  
  <p>and here is my DetailsViewModel constractor</p>
  
  <pre><code>   public EmployeeDetailViewModel(Employee model)
      {
          base.Model = model;
      }
           private ObservableCollection&lt;Religion&gt; religions;
      public ObservableCollection&lt;Religion&gt; Religions
      {
          get { return religions; }
          set
          {
              religions = value;
              NotifyPropertyChanged(m =&gt; m.Religions);
          }
      }
  
      private ObservableCollection&lt;Grade&gt; grades;
      public ObservableCollection&lt;Grade&gt; Grades
      {
          get { return grades; }
          set
          {
              grades = value;
              NotifyPropertyChanged(m =&gt; m.Grades);
          }
      }
      private ObservableCollection&lt;Department&gt; departments;
      public ObservableCollection&lt;Department&gt; Departments
      {
          get { return departments; }
          set
          {
              departments = value;
              NotifyPropertyChanged(m =&gt; m.Departments);
          }
      }
  </code></pre>
  
  <p>after all this now comes the binding  i have three comboboxes 
  for Departments, Religions and Grades  (Which are foreign keys in my employee table)</p>
  
  <pre><code> &lt;ComboBox  ItemsSource="{Binding Departments}" DisplayMemberPath="DepartmentName" SelectedValue="{Binding Model.Emp_Department, Mode=TwoWay}" SelectedValuePath="DepartmentId"/&gt;
     &lt;ComboBox  ItemsSource="{Binding Grades}" DisplayMemberPath="GradeName" SelectedValue="{Binding Model.Emp_Grade, Mode=TwoWay}" SelectedValuePath="GradeId"/&gt;
  </code></pre>
  
  <p>and so on .. The problem is that only the Departments combo box is updating the source value when i change its value </p>
  
  <p>and the other combo boxes don't .. even when the binding statement is exactly the same !! </p>
  
  <p>so sorry for writing so much .. but can anyone help me with this ?? </p>
  
  <p>thanks a lot </p>