title: Programmatically change validation rule in WPF TextBox
body: <p>I have a text input area defined like this:</p>
  
  <pre><code>    &lt;TextBox&gt;
          &lt;TextBox.Text&gt;
              &lt;Binding Path="MyProperty"&gt;
                  &lt;Binding.ValidationRules&gt;
                      &lt;valid:MyValidator/&gt;
                  &lt;/Binding.ValidationRules&gt;
              &lt;/Binding&gt;
          &lt;/TextBox.Text&gt;
      &lt;/TextBox&gt;
  </code></pre>
  
  <p>My problem is that, depending on another setting, what is supposed to be inserted here varies. And thus, the validation behavior of the input data should change.</p>
  
  <p>How can I in the code behind change the active validation rule for a certain textbox?</p>