title: MVVM, WPF, and Validation
body: <p>Well, I think i have a fairly good understanding of MVVM. But I need some clarifications.</p>
  
  <p>Is the ViewModel responsible for calling the appropriate service to persist model information? </p>
  
  <p>If so, then the ViewModel must have a clean way of determining if the data it holds is valid. If the data is valid, it will update the model accordingly. Finally, a service to persist the Model is invoked given the newly updated model. Then the question is: How do we validate the information of the ViewModel and display this easily in the View?</p>
  
  <p>I've seen a few different approaches to validation. One suggesting using IDataErrorInfo which i think is absolutely disgusting. </p>
  
  <p>Another is adding ValidationRule's to Binding.ValidationRules. However, using this approach one cannot operate in the context of the model as a whole. The ValidationRule object can only perform validation on a single value. An example might be ensuring that a value is an integer or within a certain range. </p>
  
  <p>Another idea which I just started to look into is using BindingGroup's. But I don't know a whole lot about this at this point because I'm still reading on it. </p>
  
  <p>I would like to be able to perform validation logic in a single place to be used by the View and ViewModel. In addition to this requirement, I would like to be able to perform validations against any other value in the ViewModel. Additionally, being able to prevent the ViewModel from persisting data if it is an invalid state. This would need to be easily reflected in the View. </p>
  
  <p>If anyone can point me to some articles or provide some insight to my desired approach I would be very appreciative.</p>