title: WPF Datagrid Update grouping after item edit/update
body: <p>I am relatively new to WPF was wondering if anyone could help me out.</p>
  
  <p>I have a collectionview that holds an observablecollection list that stores all my items. My datagrid's item source is the collection view. I have simple grouping in datagrid XAML...</p>
  
  <pre><code>            &lt;DataGrid.GroupStyle&gt;
              &lt;GroupStyle&gt;
                  &lt;GroupStyle.HeaderTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;StackPanel&gt;
                              &lt;TextBlock Text="{Binding Name}" FontWeight="Bold" Padding="3"/&gt;
                          &lt;/StackPanel&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/GroupStyle.HeaderTemplate&gt;
              &lt;/GroupStyle&gt;
          &lt;/DataGrid.GroupStyle&gt;
  </code></pre>
  
  <p>Now... adding / removing items works just fine, however whenever I update / edit an item the groups are not updated. Let's say for example the items are grouped by city, if I have 3 items under one city name "Seattle" then change one of those city names to "Brooklyn" the "Brooklyn" city remains under the Seattle group until i repopulate the observablecollection list. </p>
  
  <p>My current work around... is that whenever a city is changed I am literally clearing and repopulating my observablecollectionlist for the groups to update... There has to be a better way!</p>
  
  <p>My question is, is there any way to update the datagrid group, manually / dynamically whenever i update / edit an item?</p>
  
  <p><strong>Note</strong> INotifyPropertyChanged I am 90% sure is not the problem here, I have tried all manner of combinations with this interface, the groups will not update whenever I am editing / updating items. However whenever I add an item if it is a new city, a new group would be created, if I removed all items in a city, that city group would also be removed. Also its not just specific items, its any item column.</p>
  
  <p><strong>EDIT</strong> ok, still no solution... but I found another work around, which once again is not the most elegant. I put an event handler for the city box.. so whenever the city is changed the event handler is called, and I refresh the collectionview. However the event is called whenever I add an item, called when I click on the item, and called twice whenever I make a change so it's not every efficient.. still looking for ideas.</p>
  
  <p><strong>EDIT2</strong> I am now looking into the BeginEdit and EndEdit of IEditableObject to see if this will give me what I need</p>
  
  <p>Any help is GREATLY appreciated, thank you!</p>