I have a ListView (shown below). I would like the cells to flash a colour when the value displayed changes (ideally one colour for increases, one for decreases).
I know how to write the animation for the colour (below), and I'm pretty sure I need to use a cell template so I can hook a trigger up to the style to start the animation. I'm just unsure what the best place to hook the trigger up to.
I was hoping that I could hook into the PropertyChanged events, but I'm not sure how.
<ListView ItemsSource="{Binding MyListItems}">
<ListView.View>
<GridView>
<GridViewColumn Header="Value1" Width="50" CellTemplate="{StaticResource Value1CellTemplate}" />
<GridViewColumn Header="Value2" Width="50" DisplayMemberBinding="{Binding Value2}" />
</GridView>
</ListView.View>
</ListView>
Cell Template and Colour Animation:
<DataTemplate x:Key="Value1CellTemplate">
<TextBlock Text="{Binding LowerBound}" HorizontalAlignment="Right" />
</DataTemplate>
<Storyboard x:Key="IncreaseValueColourAnimation" Duration="0:0:2">
<ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames.KeyFrames>
<LinearColorKeyFrame Value="Red" KeyTime="0:0:0.1" />
<LinearColorKeyFrame Value="Transparent" KeyTime="0:0:2" />
</ColorAnimationUsingKeyFrames.KeyFrames>
</ColorAnimationUsingKeyFrames>
</Storyboard>