title: WPF DataGrid Validation Bug?
body: <p>This may be intended functionality, but it sure seems like a bug to me.</p>
  
  <p>I'm using the out-of-the-box WPF DataGrid, bound to an ObservableCollection and <em>attempting</em> to use some validation rules in order to provide nice user feedback. Needless to say there are more issues than I can count, but I'll stick with the immediate.</p>
  
  <p>Here is a summary of the problem:</p>
  
  <ol>
  <li>Bind <code>ItemsSource</code> property to an <code>ObservableCollection&lt;T&gt;</code></li>
  <li>Populate the collection</li>
  <li>Edit an item in the grid in a way which will cause a validation error</li>
  <li>Programatically remove that item from the <code>ObservableCollection&lt;T&gt;</code></li>
  </ol>
  
  <p>When these steps are performed, the GridView properly recognizes that the item has been removed from the collection, and removes the row from the grid. However, <strong>the Grid is now stuck in an invalid state and no further actions can be performed through the UI on the Grid!</strong></p>
  
  <p>Again, this seems quite like a major bug to me as being able to programmatically remove items from a collection is kind of a big deal.</p>
  
  <p>Has anybody run into this? Any suggestions for how to get around it?</p>
  
  <p>It is worth noting that I have created a separate solution just to isolate this problem, but to answers some questions you might have:</p>
  
  <p><em>Does your object implement <code>INotifyPropertyChanged</code>?</em> <strong>YES</strong></p>
  
  <p><em>Is this a custom collection?</em> <strong>No plain old <code>ObservableCollection&lt;T&gt;</code></strong></p>
  
  <p><em>How are you removing items from your collection?</em>  </p>
  
  <pre><code>//Find any newly added item and remove it  
  var someObject = SomeObjects
               .Where(obj =&gt; obj.SomeProperty == SomeValue)
               .First();
  
  SomeObjects.Remove(someObject );
  </code></pre>
  
  <p><em>How are you binding your validation rule?</em></p>
  
  <pre><code>&lt;DataGridTextColumn Header="SomeProperty"&gt;
      &lt;DataGridTextColumn.Binding&gt;
          &lt;Binding Path="SomeProperty"&gt;
              &lt;Binding.ValidationRules&gt;
                  &lt;val:RequiredValidator ValidationStep="ConvertedProposedValue" 
                       ValidatesOnTargetUpdated="True" /&gt;
              &lt;/Binding.ValidationRules&gt;
          &lt;/Binding&gt;
      &lt;/DataGridTextColumn.Binding&gt;
  &lt;/DataGridTextColumn&gt;
  </code></pre>
  
  <p><em>What does your validation rule look like?</em></p>
  
  <pre><code>public class RequiredValidator : ValidationRule
  {
      public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
      {
          if (value == null || String.IsNullOrWhiteSpace(value as String))
              return new ValidationResult(false, "Field is required!");
  
          return ValidationResult.ValidResult;
      }
  }
  </code></pre>