title: Custom validation of textbox in WPF
body: <p>So I'm trying to do something along this example: <a href="http://www.codeproject.com/KB/WPF/wpfvalidation.aspx" rel="nofollow">http://www.codeproject.com/KB/WPF/wpfvalidation.aspx</a></p>
  
  <p>My Textbox currently looks like this:</p>
  
  <pre><code>&lt;TextBox Height="23" HorizontalAlignment="Left" Margin="118,60,0,0" Name="CreateUserCPRTextbox" VerticalAlignment="Top" Width="120"  &gt;
                  &lt;TextBox.Text&gt;
  
                      &lt;Binding Path="Name" UpdateSourceTrigger="LostFocus"&gt;
                          &lt;Binding.ValidationRules&gt;
                              &lt;validators:TextRangeValidator
                          MinimumLength="10"
                          MaximumLength="10"
                          ErrorMessage="ID has to be 10 letters" /&gt;
                          &lt;/Binding.ValidationRules&gt;
                      &lt;/Binding&gt;
                  &lt;/TextBox.Text&gt;
  
              &lt;/TextBox&gt;
  </code></pre>
  
  <p>I've directly copied my TextRangeValidator from the example on that website. Nothing happens when I lose focus on the textbox. No matter what I type in it. Any Ideas? :)</p>