title: How can I validate multiple properties when any of them changes?
body: <p>I have two date fields: StartDate and EndDate. StartDate must be earlier than EndDate.</p>
  
  <p>If the user changes the StartDate to something greater than the EndDate, a red border appears around that DatePicker, and vise versa. If the user changes the 2nd box so that the date range is now correct, the 1st box still has the Validation Error.</p>
  
  <p>How can I validate both date fields when either one of them changes?</p>
  
  <p><img src="https://i.stack.imgur.com/ygi6S.jpg" alt="enter image description here"></p>
  
  <p>I'm using <code>IDataErrorInfo</code></p>
  
  <pre><code>public string GetValidationError(string propertyName)
  {
      switch (propertyName)
      {
          case "StartDate":
              if (StartDate &gt; EndDate)
                  s = "Start Date cannot be later than End Date";
              break;
  
          case "EndDate":
              if (StartDate &gt; EndDate)
                  s = "End Date cannot be earlier than Start Date";
              break;
      }
  
      return s;
  }
  </code></pre>
  
  <p>I cannot simply raise a PropertyChange event because I need to validate both fields when either of them changes, so having both of them raise a PropertyChange event for the other will get stuck in an infinite loop.</p>
  
  <p>I also do not like the idea of clearing the Date field if the other date returns a validation error.</p>