title: WPF: How To Implement Extensive Data-Validation in MVVM
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/921601/how-can-i-handle-a-validation-error-in-my-viewmodel-instead-of-my-views-code-beh">How can I handle a Validation.Error in my ViewModel instead of my View&#39;s code behind?</a>  </p>
  </blockquote>
  
  
  
  <p>The usual examples of how to use Data-Validation in WPF usually only involves defining an error template for the control and displaying the error message in the control tooltip. What I want to do is to create a collection of all ValidationErrors, display it in an ItemsControl to the user and focus the invalid control when the user clicks on the associated (error) item in the ItemsControl.</p>
  
  <p>In non-MVVM projects that ain't much of a problem since I can invoke Validation.GetErrors(obj) on every control and build my collection with that. But in the MVVM the ViewModel has no direct link to the View and therefore I cannot invoke GetErrors() in the ViewModel to build my collection, since I do not have any reference to the controls on the View.</p>
  
  <p>Is there any trick to bind or route the ValidationErrors from the View to the ViewModel or is this just impossible to achieve in the MVVM?</p>