我有几个文本块,绑定到不同的东西。两个文本块应用了相同的样式。在样式中有一个eventtrigger,当绑定值更新时,它会闪烁文本。但是当一个textblock的值更新时,两个textblocks都会闪烁。我以为只有一个文本块会闪现。有什么想法吗?
<Style x:Key="flashingTextBlock" TargetType="TextBlock">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="#333333" />
<Style.Triggers>
<EventTrigger RoutedEvent="Binding.TargetUpdated">
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)"
To="Orange"
Duration="0:0:1"
AutoReverse="True"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
<TextBlock Text="{Binding Path=PcName, NotifyOnTargetUpdated=True}"
Style="{StaticResource flashingTextBlock}"/>
<TextBlock Text="{Binding Path=Time, NotifyOnTargetUpdated=True}"
Style="{StaticResource flashingTextBlock}"/>