title: wpf datagrid - Datagrid not getting refreshed when items are removed from ObservableCollection
body: <p>I have an ObservableCollection defined as follows</p>
  
  <pre><code>private ObservableCollection&lt;RelayConfig&gt; _relayConfigs;
  public ObservableCollection&lt;RelayConfig&gt; RelayConfigs { 
      get {return  _relayConfigs;}
      set { _relayConfigs = value; }
  }
  </code></pre>
  
  <p>This is bound to wpf Datagrid using ItemsSource attribute and populated as given below </p>
  
  <pre><code>RelayConfigs = new ObservableCollection&lt;RelayConfig&gt;(unitOfWork.RelayConfigRepository.GetQueryable().Include(rc =&gt; rc.StandardContacts));
  </code></pre>
  
  <p>I am removing items from ObservableCollection that matches a specific criteria like this.</p>
  
  <pre><code>RelayConfigs.RemoveWhere(r =&gt; r.IsMarked);
  </code></pre>
  
  <p>RemoveWhere is an Extension method for ObservableCollection, defined like this</p>
  
  <pre><code>public static void RemoveWhere&lt;T&gt;(this ICollection&lt;T&gt; collection, Func&lt;T, bool&gt; predicate) {
      var i = collection.Count;
      while (i-- &gt; 0) {
          var element = collection.ElementAt(i);
          if (predicate(element)) {
              collection.Remove(element);
          }
      }
  }
  </code></pre>
  
  <p>The issue is that when I remove some rows from the ObservableCollection using the above setup, I don't see the DataGrid getting refreshed. The rows still linger around in the DataGrid, when infact it does not exist in the ObservableCollection. Any ideas why Datagrid does not get refreshed.</p>