title: DataGrid causes BeginEdit() method to run twice
body: <p>I have implemented <code>IEditableObject</code> for my <strong>ViewModel</strong> and the below controls are bound to it. </p>
  
  <p>Now when the first time I fire up the <code>Window</code> containing these controls, the <code>BeginEdit()</code> method runs and backs up the variables. </p>
  
  <p><strong>My problem is this:</strong> When I start editing the <code>DataGrid</code> again the <code>BeginEdit()</code> method runs and saves the changes to my already backed up variables! This ruins the purpose of the <code>BeginEdit()</code> and <code>CancelEdit()</code>. Now if I choose to cancel the Window, I won't have the original data. How can I prevent this?</p>
  
  <pre><code>&lt;ComboBox ItemsSource="{Binding Path=CoatingFactors}"
            SelectedItem="{Binding Path=CoatingFactor}"&gt;
  &lt;/ComboBox&gt;
  
  &lt;DataGrid ItemsSource="{Binding Path=CustomCFactors}"                      
    ....
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>Here is how I have implemented the <code>BeginEdit()</code> and <code>CancelEdit()</code> methods:</p>
  
  <pre><code>private List&lt;CustomCFactorItem&gt; customCFactors_ORIGINAL;
  private double coatingFactor_ORIGINAL;
  
  
  public void BeginEdit()
  {
      customCFactors_ORIGINAL = customCFactors.ConvertAll(o =&gt; o.Clone()).ToList();
      coatingFactor_ORIGINAL = coatingFactor;
  }
  
  public void CancelEdit()
  {
      customCFactors = customCFactors_ORIGINAL.ConvertAll(o =&gt; o.Clone()).ToList();
      coatingFactor = coatingFactor_ORIGINAL;
  }
  </code></pre>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>For now, I'm using a little hack like this:</p>
  
  <pre><code>    private List&lt;CustomCFactorItem&gt; customCFactors_ORIGINAL;
      private double coatingFactor_ORIGINAL;
  
      private int editNum = 0;
  
      public void BeginEdit()
      {
          if (editNum &gt; 0) return;
  
          editNum++;
  
          customCFactors_ORIGINAL = customCFactors.ConvertAll(o =&gt; o.Clone());
          coatingFactor_ORIGINAL = coatingFactor;
      }
  
      public void EndEdit()
      {
          editNum = 0;
      }
  
      public void CancelEdit()
      {
          editNum = 0;
  
          customCFactors = customCFactors_ORIGINAL.ConvertAll(o =&gt; o.Clone());
          coatingFactor = coatingFactor_ORIGINAL;
      }
  </code></pre>