【发布时间】:2014-05-14 11:04:01
【问题描述】:
我遵循了这个问题中描述的方法:Highlighting cells in WPF DataGrid when the bound value changes
<Style x:Key="ChangedCellStyle" TargetType="DataGridCell">
<Style.Triggers>
<EventTrigger RoutedEvent="Binding.TargetUpdated">
<BeginStoryboard>
<Storyboard>
<ColorAnimation Duration="00:00:15"
Storyboard.TargetProperty=
"(DataGridCell.Background).(SolidColorBrush.Color)"
From="Yellow" To="Transparent" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
<DataGridTextColumn Header="Status"
Binding="{Binding Path=Status, NotifyOnTargetUpdated=True}"
CellStyle="{StaticResource ChangedCellStyle}" />
我面临的问题是,当底层属性值没有改变时,动画没有被触发。在上面给出的例子中,如果“Status”属性的值没有改变,那么动画就不会被触发。有没有办法,不管值有没有变化,我都可以触发动画。
谢谢。
【问题讨论】:
标签: c# wpf wpfdatagrid