title: CollectionViewSource Not Updating with PropertyChanged
body: <p>I'm having an enormous amount of trouble with ComboBoxes in a data grid.
  And really would like some help, i think i've gotten confused by the amount of research and things i've tried. This really should be simple so i must be missing something.</p>
  
  <p><strong>SIMPLIFIED PROBLEM</strong></p>
  
  <p>I use a CollectionViewSource in xaml, the C# sets the source of that CollectionViewSource to an ObservableCollection in a class that is the Page's datacontext.
  Adding items to the collection does not update the DataGridComboBox column containing that displays the view source.
  See below the line for more detail</p>
  
  <hr>
  
  <p><strong>OVERVIEW</strong></p>
  
  <p>I have a WPF Page with a datagrid on it.
  The page has its data context set to a view model.
  The viewModel contains two observable collections. One for Equips and One for Locations.
  Each Equip has a Location.
  <em>These are populated from a code first EF database but i believe that this problem is above that level.</em></p>
  
  <p>The datagrid is one row per Equip. The Location column needs to be a selectable combobox that allows the user to change Location.</p>
  
  <p>The only way i could get the location combobox to populate at all is by binding it to a separate collection view source.</p>
  
  <p><strong>PROBLEM</strong></p>
  
  <p>It seems that if the Page loaded event occurs prior to the ViewModel populating the ObservableCollection then the locationVwSrc will be empty and the property changed event doesn't get this to change.</p>
  
  <p><strong>IMPLEMENTATION SHORT VERSION</strong>
  Page has a collection viewSource defined in the xaml.</p>
  
  <pre><code>Loaded="Page_Loaded"
    Title="EquipRegPage"&gt;
  &lt;Page.Resources&gt;
      &lt;CollectionViewSource x:Key="locationsVwSrc"/&gt;
  &lt;/Page.Resources&gt;
  </code></pre>
  
  <p>The datagrid is defined with xaml.</p>
  
  <pre><code>&lt;DataGrid x:Name="equipsDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" Margin="10,10,-118,59" 
                ItemsSource="{Binding Equips}" EnableRowVirtualization="True" AutoGenerateColumns="False"&gt;
  </code></pre>
  
  <p>The combobox column defined in xaml</p>
  
  <pre><code>&lt;DataGridComboBoxColumn x:Name="locationColumn" Width="Auto" MaxWidth="200" Header="Location"
                                      ItemsSource="{Binding Source={StaticResource locationsVwSrc}, UpdateSourceTrigger=PropertyChanged}"
                                      DisplayMemberPath="Name"
                                      SelectedValueBinding="{Binding Location}"
  </code></pre>
  
  <p>The page context set to the view model</p>
  
  <pre><code>public partial class EquipRegPage : Page
  {
      EquipRegVm viewModel = new EquipRegVm();
  
      public EquipRegPage()
      {
          InitializeComponent();
          this.DataContext = viewModel;
      }
  </code></pre>
  
  <p>Loaded event setting the context</p>
  
  <pre><code>private void Page_Loaded(object sender, RoutedEventArgs e)
      {
          // Locations View Source
          System.Windows.Data.CollectionViewSource locationViewSource =
              ((System.Windows.Data.CollectionViewSource)(this.FindResource("locationsVwSrc")));
          locationViewSource.Source = viewModel.Locations;
          // Above does not work if the viewmodel populates these after this call, only works if its populated prior.
          //TODO inotifypropertychanged not correct? This occurs before the viewmodels loads, and doesn't display.
          // Therefore notify property changes aren't working.
  
          // Using this as cheat instead instead works, i beleive due to this only setting the source when its full
          //viewModel.Db.Locations.Load();
          //locationViewSource.Source = viewModel.Db.Locations.Local;
          //locationViewSource.View.Refresh();
      }
  </code></pre>
  
  <p>The ViewModel class and how it loads</p>
  
  <pre><code>public class EquipRegVm : DbWrap, INotifyPropertyChanged
  {
      /// &lt;summary&gt;
      /// Event triggered by changes to properties. This notifys the WPF UI above which then 
      /// makes a binding to the UI.
      /// &lt;/summary&gt;
      public event PropertyChangedEventHandler PropertyChanged;
  
      /// &lt;summary&gt;
      /// Notify Property Changed Event Trigger
      /// &lt;/summary&gt;
      /// &lt;param name="propertyName"&gt;Name of the property changed. Must match the binding path of the XAML.&lt;/param&gt;
      void RaisePropertyChanged(string propertyName)
      {
          if (PropertyChanged != null)
              PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
      }
  
  
      public ObservableCollection&lt;Equip&gt; Equips { get; set; }
  
      public ObservableCollection&lt;Location&gt; Locations { get; set; }
  
      public EquipRegVm() : base()
      {
          Load();
      }
  
      /// &lt;summary&gt;
      /// Load the data from the Model.
      /// &lt;/summary&gt;
      public async void Load()    //TODO async an issue?
      {
          // EQUIPMENT
          ObservableCollection&lt;Equip&gt; eqList = new ObservableCollection&lt;Equip&gt;();
          var eqs = await (from eq in Db.Equips
                          orderby eq.Tag
                          select eq).ToListAsync();
          foreach(var eq in eqs)
          {
              eqList.Add(eq);
          }
          Equips = eqList;
          RaisePropertyChanged("Equips");
  
  
          // LOCATIONS
          ObservableCollection&lt;Location&gt; locList = new ObservableCollection&lt;Location&gt;();
          var locs = await (from l in Db.Locations
                           orderby l.Name
                           select l).ToListAsync();
          foreach (var l in locs)
          {
              locList.Add(l);
          }
          Locations = locList;
          RaisePropertyChanged("Locations");
      }
  }
  </code></pre>