title: How to forbid automatic databinding on validation error
body: <p>I'm creating a simple database application in C# WPF using MVVM as Relay Commands and databinding. For in-memory storage of database content I use <code>ObservableCollection</code>, which is binded to the Datagrid as follows:</p>
  
  <p><code>&lt;DataGrid ItemsSource="{Binding Path=Softwares, Mode=OneWay}" SelectedItem="{Binding Path=SoftwareSelection, Mode=TwoWay}"&gt;</code></p>
  
  <p>when the item is selected user can chose to edit it. For editation a form is opened with a bunch of textboxes with the data of given entity. All the fields are validated using <code>IDataErrorInfo</code>, unless all textboxes are valid, the ok button is not enabled, and therefore no changes can be saved to the collection and to the database. </p>
  
  <p>Here is how the example textbox looks like: </p>
  
  <p><code>&lt;TextBox Text="{Binding Name, Mode=TwoWay, ValidatesOnDataErrors=True,  UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True}"/&gt;</code></p>
  
  <p>But the tricky part is, in case I change some values in textboxes and then close the window, the new values are propagated to the <code>ObservableCollection</code>, which I don't want to. Do you have any idea, how to prevent such behaviour? I would like the databinding work only after clicking the button. Otherwise the databindng works well, so as the button (dis/en)abling and reflecting changes to the database and to the collection after clicking. Both views are serviced by different ViewModels, data between views are passed by firing events.</p>
  
  <p>I tried to add to the <code>DataGrid</code> <code>UpdateSourceTrigger=Explicit</code> to the ItemsSource binding, but didn't help. Perhaps, I'm missing some application logic?</p>
  
  <p>Thank you very much for your help.</p>