title: WPF highlighting tab headers where validation fails
body: <p>I currently have a tab control containing multiple tab items, where each tab item contains different custom user control. <strong>I would like the tab headers to turn red when the associated tab contains a validation failure</strong>. My validations are implemented as ValidationRules on the appropriate bindings (moving to IDataError or another validation approach is not a feasible solution). Each tab specific control tracks it's errors through the bubbling ValidationErrorsEvent and exposes a count. </p>
  
  <p>I am currently using x:Name on the tab specific controls &amp; ElementName in the TabItem headers to bind the count exposed by the tab specific controls to the color of the text in the header (via a converter).</p>
  
  <pre><code>&lt;TabControl&gt;
      &lt;TabItem&gt;
          &lt;TabItem.Header&gt;
              &lt;TextBlock Text="Tab 1" Foreground="{Binding Errors.Count, ElementName=_tabOne, Converter={StaticResource ErrorCountToColorConverter}}" /&gt;
          &lt;/TabItem.Header&gt;
          &lt;AdornerDecorator&gt;
              &lt;my:CustomTabOneControl x:Name="_tabOne" /&gt;
          &lt;/AdornerDecorator&gt;
      &lt;/TabItem&gt;
      &lt;TabItem&gt;
          &lt;TabItem.Header&gt;
              &lt;TextBlock Text="Tab 2" Foreground="{Binding Errors.Count, ElementName=_tabTwo, Converter={StaticResource ErrorCountToColorConverter}}" /&gt;
          &lt;/TabItem.Header&gt;
          &lt;AdornerDecorator&gt;
              &lt;my:CustomTabTwoControl x:Name="_tabTwo" /&gt;
          &lt;/AdornerDecorator&gt;
      &lt;/TabItem&gt;
  &lt;/TabControl&gt;
  </code></pre>
  
  <p>Due to the lazyness of WPFs tab control, the validation of each tab does not occur until it is opened. As such the headers for tabs containing invalid fields do not turn red until the tab has been opened (after that they remain correct).</p>
  
  <p>Can anyone suggest a way of resolving this issue, or an alternative approach to achieve the same tab highlighting?</p>