Vous devez créer un style pour l'en-tête qui comprend une animation à clignoter/clignote au premier plan d'en-tête. Une fois que vous avez cela, vous pouvez l'appliquer quand vous en avez besoin.
L'exemple ci-dessous fait cela. Vous voudrez peut-être modifier cela, placez donc l'arrière-plan à la place pour que l'ensemble de l'onglet ne clignote pas seulement avec le texte TabItems.
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Window.Resources>
<Style x:Key="FlashingHeader" TargetType="TabItem">
<Setter Property="TabItem.HeaderTemplate">
<Setter.Value>
<DataTemplate>
<!--Make The Header -->
<TextBlock x:Name="header" Foreground ="Black" Text="{Binding}"/>
<!--Make The Background Flash-->
<DataTemplate.Triggers>
<Trigger Property="Visibility" Value="Visible">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard Storyboard.TargetName="header" AutoReverse="True" RepeatBehavior="Forever" Storyboard.TargetProperty="Foreground.Color">
<ColorAnimation To="Transparent" AutoReverse="True" Duration="0:0:0.5" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<StackPanel>
<TabControl Height="150">
<TabItem x:Name="one" Header="Page One"></TabItem>
<TabItem x:Name="two" Header="Page Two"></TabItem>
<TabItem x:Name="three" Header="Page Three"></TabItem>
</TabControl>
<StackPanel Orientation="Horizontal">
<Label >Tab Number:</Label>
<TextBox x:Name="userInput" Width="80">two</TextBox>
<Button Click="StartFlash_Click">Start Flash</Button>
<Button Click="StopFlash_Click">Stop Flash</Button>
</StackPanel>
</StackPanel>
</Window>
Puis dans le code C#, vous pouvez définir le style à chaque fois que nécessaire:
private void StartFlash_Click(object sender, RoutedEventArgs e)
{
TabItem ti = (TabItem)this.FindName(userInput.Text);
if (ti != null)
{
ti.SetValue(Control.StyleProperty, (Style)this.Resources["FlashingHeader"]);
}
}
private void StopFlash_Click(object sender, RoutedEventArgs e)
{
TabItem ti = (TabItem)this.FindName(userInput.Text);
if (ti != null)
{
ti.Style = null;
}
}