title: WPF TextBox Validation Style Disappears when Mouse is over, or it has focus
body: <p>I am creating a custom text box control to have some default formatting and validation functionality, including a custom validation property which accepts an Action or custom function.</p>
  
  <p>In my current situation I can't use the Attribute validation framework that some people have posted, since I don't quite have access to modify the data model objects.  I also cannot use ValidationRules because not all textboxes that require these validations will be bound.</p>
  
  <p>I have used the generic textbox style in the static constructor rather than define my own, but I added some data triggers to set the border and tooltip based on my custom IsValid dependency property.  </p>
  
  <p>Everything seems to be working well, but the problem is when I mouse over or click on a textbox that has failed validation, the "invalid" style disappears and it goes to the default textbox style.</p>
  
  <p>I have tried to create some additional datatriggers for IsMouseOver, IsFocused and IsMouseCaptured event (shown below) to no avail.</p>
  
  <p>Am I missing something?</p>
  
  <p>The Static Constructor (showing I'm using the TextBox style:</p>
  
  <pre><code>    static ValidatorTextBox()
      {
          //Commenting this line out to use the default textbox style
          DefaultStyleKeyProperty.OverrideMetadata(typeof(ValidatorTextBox), new FrameworkPropertyMetadata(typeof(TextBox)));
      }
  </code></pre>
  
  <p>And here's my style:</p>
  
  <pre><code> &lt;Style TargetType="{x:Type local:ValidatorTextBox}"&gt;
      &lt;Style.Triggers&gt;
          &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsValid}" Value="False"&gt;
              &lt;Setter Property="BorderBrush" Value="Red" /&gt;
              &lt;Setter Property="BorderThickness" Value="1" /&gt;
          &lt;/DataTrigger&gt;
          &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsRequired}" Value="True"&gt;
              &lt;Setter Property="Background" Value="AliceBlue" /&gt;
          &lt;/DataTrigger&gt;
          &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsFocused}" Value="True"&gt;
              &lt;Setter Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource Self}, Path=BorderBrush}" /&gt;
          &lt;/DataTrigger&gt;
          &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}" Value="True"&gt;
              &lt;Setter Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource Self}, Path=BorderBrush}" /&gt;
          &lt;/DataTrigger&gt;
          &lt;DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseCaptured}" Value="True"&gt;
              &lt;Setter Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource Self}, Path=BorderBrush}" /&gt;
          &lt;/DataTrigger&gt;
      &lt;/Style.Triggers&gt;
  &lt;/Style&gt;
  </code></pre>