【发布时间】:2020-06-09 13:09:36
【问题描述】:
我有一个 wpf 应用程序,它绑定到代码隐藏中的属性。
由于标准的 OnPropertyChanged() 行为,它们会更新 - 到目前为止一切都很好。
每当该值更新时,我想短暂地闪烁 xaml 对象的背景 - 以提醒眼睛注意值的变化。我觉得这应该很容易,但我认为存在语法问题。
到目前为止,我已经尝试过闪现一个Label的背景:
<Style TargetType="{x:Type Label}">
<Style.Triggers>
<EventTrigger RoutedEvent="Binding.TargetUpdated">
<BeginStoryboard>
<Storyboard AutoReverse="True">
<ColorAnimation Duration="0:0:0.3"
Storyboard.TargetProperty="Background"
To="Blue"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
..我做错了什么?
【问题讨论】:
-
这能回答你的问题吗? WPF animation on data change我猜,你应该指定目标名称
标签: wpf xaml data-binding eventtrigger