title: WPF TabItem color on mouse enter and mouse leave
body: <p>In my style, I'm trying to set tabitem's color for mouse enter, mouse leave and selected events. </p>
  
  <p>It's working partially, because the mouse enter and mouse leave events are fired even for the selected tab. </p>
  
  <p>I would like to ignore these events when the tab is active. Is this possible?</p>
  
  <p>This image demonstrates the current situation.</p>
  
  <p><a href="https://i.stack.imgur.com/bsFGe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bsFGe.png" alt="menuitem style"></a></p>
  
  <p>Here's my style</p>
  
  <pre><code>   &lt;Style TargetType="TabItem" x:Name="MyTab"&gt;
              &lt;Setter Property="MinHeight" Value="35" /&gt;
              &lt;Setter Property="MinWidth" Value="105" /&gt;
              &lt;Setter Property="Foreground" Value="#f2f2f2"/&gt;
              &lt;!--Template--&gt;
              &lt;Setter Property="Template"&gt;
                  &lt;Setter.Value&gt;
                      &lt;ControlTemplate  TargetType="TabItem"&gt;
                          &lt;Grid Name="Panel" Background="#424f5a" TextBlock.Foreground="#e8e8e8"&gt;
                              &lt;Border Name="Border"&gt;
                                  &lt;ContentPresenter x:Name="ContentSite"
                              VerticalAlignment="Center" HorizontalAlignment="Center"
                              ContentSource="Header" Margin="10,2"/&gt;
                              &lt;/Border&gt;
                          &lt;/Grid&gt;
                          &lt;ControlTemplate.Triggers&gt;
                              &lt;!-- Selected state--&gt;
                              &lt;Trigger Property="IsSelected" Value="True"&gt;
                                  &lt;Setter TargetName="Panel" Property="Background" Value="#383838" /&gt;
                                  &lt;Setter Property="Foreground" Value="#fbfbfb"/&gt;
                              &lt;/Trigger&gt;
                              &lt;!-- Mouse enter state --&gt;
                              &lt;EventTrigger RoutedEvent="MouseEnter"&gt;
                                  &lt;EventTrigger.Actions&gt;
                                      &lt;BeginStoryboard &gt;
                                          &lt;Storyboard&gt;
                                              &lt;ColorAnimation  Duration="0:0:0.1" To="#5e6972" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
                                                  Storyboard.TargetName="Panel"/&gt;
                                          &lt;/Storyboard&gt;
                                      &lt;/BeginStoryboard&gt;
                                  &lt;/EventTrigger.Actions&gt;
                                  &lt;EventTrigger.ExitActions&gt;
  
                                  &lt;/EventTrigger.ExitActions&gt;
                              &lt;/EventTrigger&gt;
                              &lt;!-- Mouse leave --&gt;
                              &lt;EventTrigger RoutedEvent="MouseLeave"&gt;
                                  &lt;EventTrigger.Actions&gt;
                                      &lt;BeginStoryboard&gt;
                                          &lt;Storyboard&gt;
                                              &lt;ColorAnimation  Duration="0:0:0.1" To="#424f5a" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
                                                  Storyboard.TargetName="Panel"/&gt;
                                          &lt;/Storyboard&gt;
                                      &lt;/BeginStoryboard&gt;
                                  &lt;/EventTrigger.Actions&gt;
                              &lt;/EventTrigger&gt;
                          &lt;/ControlTemplate.Triggers&gt;
                      &lt;/ControlTemplate&gt;
                  &lt;/Setter.Value&gt;
              &lt;/Setter&gt;
          &lt;/Style&gt;
  </code></pre>