title: How to change the background color of a Passwordbox for WPF/C#
body: <p>I have a class called PasswordValidationRules</p>
  
  <p>It's a simple class</p>
  
  <pre><code>    public bool validatePasswordRules(String text)
      {
          Regex regex = new Regex(@"^(?=.{8}$)(?=.*[A-Z])(?=.*[0-9])(?=.*[,@#$])");
          bool isValid = regex.IsMatch(text);
          if (isValid)
          {
              return true;
          }
          else
          {                
              return false;
          }
      }
  </code></pre>
  
  <p>I want to check the rules as the user types into a PasswordBox.</p>
  
  <p>I would like to have it trigger only when 8 characters are typed and the background would change to green if "true", otherwise it should have a red background.</p>