2

我不确定为什么以下不起作用。当绑定模型属性更改时,我尝试每 0.2 秒隐藏和显示一个文本框,持续 1.2 秒。任何人都可以看到这种风格的问题或我是如何尝试这样做的吗?

<Style x:Key="FlashStyle" TargetType="TextBlock">
        <Style.Triggers>
            <EventTrigger RoutedEvent="Binding.TargetUpdated" >
                <EventTrigger.Actions>
                    <BeginStoryboard>
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.Visibility)">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00.2" Value="{x:Static Visibility.Visible}"/>
                                <DiscreteObjectKeyFrame KeyTime="00:00:00.4" Value="{x:Static Visibility.Collapsed}"/>
                                <DiscreteObjectKeyFrame KeyTime="00:00:00.6" Value="{x:Static Visibility.Visible}"/>
                                <DiscreteObjectKeyFrame KeyTime="00:00:00.8" Value="{x:Static Visibility.Collapsed}"/>
                                <DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger.Actions>
            </EventTrigger>
        </Style.Triggers>
    </Style>

    <TextBlock Text="{Binding Data.QuotePrice, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource FlashStyle}" />
4

1 回答 1

3

事件不发生Binding.TargetUpdated

当值从绑定源传输到绑定目标时发生,但仅适用于NotifyOnTargetUpdated值设置为 的绑定true

除了优先级(如果这是您的实际代码,这应该没问题)之外,我唯一能想到的事情。

于 2012-08-07T21:42:40.470 回答