title: WPF DataGrid 'Refresh' is not allowed during an AddNew or EditItem transaction mvvm
body: <p>I have the following grid </p>
  
  <pre><code>    &lt;DataGrid
  
          x:Name="TablesDataGrid"
          Grid.Column="0"
          Grid.Row="1"
          ItemsSource="{Binding FilteredModels.View}"
          AlternationCount="2"
          AutoGenerateColumns="False"
          CanUserSortColumns="True"
          CanUserReorderColumns="False"
    CanUserDeleteRows="False"
    CanUserAddRows="False"
    SelectionMode="Extended"
          IsReadOnly="False"
    SelectionUnit="FullRow"
          RowHeight="25"
    HorizontalAlignment="Stretch"
    ColumnWidth="Auto"&gt;
              &lt;DataGrid.Columns &gt;
                  &lt;DataGridCheckBoxColumn Width="*" Binding="{Binding IsChecked, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"  IsReadOnly="False"&gt;
                      &lt;DataGridCheckBoxColumn.HeaderTemplate&gt;
                          &lt;DataTemplate&gt;
                              &lt;CheckBox IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}, Path=DataContext.CheckAll}"/&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/DataGridCheckBoxColumn.HeaderTemplate&gt;
                  &lt;/DataGridCheckBoxColumn&gt;
                  &lt;DataGridTextColumn Header="Source Table" Binding="{Binding SourceTableFullName}" Width="4*"&gt;&lt;/DataGridTextColumn&gt;
                  &lt;DataGridTextColumn Header="EDW Schema"  Binding="{Binding SchemaName}" Width="2*"&gt;&lt;/DataGridTextColumn&gt;
                  &lt;DataGridTextColumn Header="EDW Table" Binding="{Binding TableName}" Width="4*"&gt;&lt;/DataGridTextColumn&gt;
                  &lt;DataGridTextColumn Header="Status" Binding="{Binding Status}" Width="*"&gt;&lt;/DataGridTextColumn&gt;
              &lt;/DataGrid.Columns&gt;
          &lt;/DataGrid&gt;
  </code></pre>
  
  <p>and then i have a seachCommand with performs the search on the collectionViewSource FilteredModels in the viewmodel and then calls</p>
  
  <pre><code>this.FilteredModels.View.Refresh();
  </code></pre>
  
  <p>when a user checks a few of the checkboxes and sends the grid into editmode and then performs a search we get the following error</p>
  
  <pre><code>WPF DataGrid 'Refresh' is not allowed during an AddNew or EditItem transaction
  </code></pre>
  
  <p>is there a way to force the grid out of edit mode when a check box is checked or maybe even when the seach button is clicked or some other fix for this?</p>
  
  <p>thanks!</p>