title: WPF MVVM observable collection not updating GUI
body: <p>Im designing an MVVM WPF app, and have a ViewModel which has a property called SelectedCustomer, of type Customer. This object has a property called SummaryDetails of type ObservableCollection which renders into a ListView, line by line. </p>
  
  <p>To do this, I have created a separate property on the ViewModel called CustomerSummaryDetails which contains simply a get, that returns the collection contained within the customer I mentioned above. </p>
  
  <p>In the XAML I have bound the ItemsSource to the CustomerSummaryDetails Property.</p>
  
  <p>This was so I didnt have to bind to SelectedCustomer.SummaryDetails which isn't as clean. </p>
  
  <p>The SelectedCustomer property has a get and a set method, and the set calls OnPropertyChanged for the OTHER property, CustomerSummaryDetails, letting the XAML know that the underlying collection has changed and to update.</p>
  
  <p>The problem is though that when I update an item within the collection, it is not reflecting on the GUI, despite all the right events being called. I have stepped in and the set method of the SelectedCustomer is being called, and I then follow the OnPropertyChanged("CustomerSummaryDetails") call which goes into the "get" method of the CustomerSummaryDetails property as expected. I have delved into the value of the returned collection at this point, and the value within the list is the updated value, however nothing is getting reflected on the GUI, so I am puzzled as it seems the GUI is calling the get method to update it on the OnPropertyChanged() call, but it is not reflecting visually.</p>
  
  <p>UPDATE - CODE INCLUDED</p>
  
  <p>Sorry for not including code, I thought it would be easier to just describe but here are the main ViewModel properties</p>
  
  <pre><code>public CustomerSummaryViewModel SelectedCustomer
  {
      get { return _selectedCustomer; }
      set
      {
          _selectedCustomer = value;
          OnPropertyChanged("CustomerSummaryDetails");
      }
  }
  
  public ObservableCollection&lt;RbcUICustomerSummary&gt; CustomerSummaryDetails
  {
      get { return _selectedCustomer.SummaryDetails; }
  }
  
  public ItemSummaryViewModel SelectedItem
  {
      get { return _selectedItem; }
      set
      {
          _selectedItem = value;
          OnPropertyChanged("SelectedItem");
      }
  }
  </code></pre>
  
  <p>XAML below</p>
  
  <pre><code>    &lt;ListView x:Name="lvCustomerSummary" Margin="10,10,10,10" Background="#F4F8FB" ItemsSource="{Binding CustomerSummaryDetails}" MouseDoubleClick="lvCustomerSummary_MouseDoubleClick" ItemContainerStyle="{StaticResource myHeaderStyleColor}" VirtualizingStackPanel.IsVirtualizing="False" VirtualizingStackPanel.VirtualizationMode="Recycling"&gt;
              &lt;ListView.View&gt;
              &lt;GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle}"&gt;
                      &lt;GridView.Columns&gt;
                      &lt;GridViewColumn Header=""  &gt;
                          &lt;GridViewColumn.CellTemplate&gt;
                              &lt;DataTemplate &gt;
                                  &lt;Grid&gt;
                                      &lt;Image Source="{z:ImageStaticResource {Binding IconSelect}}" Width="20" Height="20" /&gt;
                                  &lt;/Grid&gt;
                              &lt;/DataTemplate&gt;
                          &lt;/GridViewColumn.CellTemplate&gt;
                      &lt;/GridViewColumn&gt;
                      &lt;GridViewColumn Width="200" Header="SubCustType" DisplayMemberBinding="{Binding SubCustType}" &gt;
                      &lt;/GridViewColumn&gt;
                      &lt;GridViewColumn Width="200" Header="SubCustValue"  DisplayMemberBinding="{Binding SubCustValue}"&gt;
                      &lt;/GridViewColumn&gt;
                      &lt;GridViewColumn Header=""  &gt;
                          &lt;GridViewColumn.CellTemplate&gt;
                              &lt;DataTemplate &gt;
                                  &lt;Grid&gt;
                                      &lt;Image Source="{z:ImageStaticResource {Binding IconFlag}}" Width="20" Height="20" /&gt;
                                  &lt;/Grid&gt;
                              &lt;/DataTemplate&gt;
                          &lt;/GridViewColumn.CellTemplate&gt;
                      &lt;/GridViewColumn&gt;
                  &lt;/GridView.Columns&gt;
              &lt;/GridView&gt;
          &lt;/ListView.View&gt;
      &lt;/ListView&gt;
  </code></pre>
  
  <p>And finally the Updater method which does the actual update</p>
  
  <pre><code>private void DisplayCustomerComment(string commentEnt)
  {            
      if (_queueViewModel.SelectedCustomer == null) return;
          var selCust = _queueViewModel.SelectedCustomer;
  
      foreach (var t in selCust.SummaryDetails
          .Where(t =&gt; t.SubCustType == AppString.CustomerSummary.Comment))
      {
          t.SubCustValue = commentEnt;
          break;
      }
  
      _queueViewModel.SelectedCustomer = selCust;
  }
  </code></pre>