I want to animate the textbox (Price) backround color depending on the new value from the ViewModel.
Color can be different depending on the new value (greater 0 -> green - less 0 -> red)
The only animation i can see is at startup when the new value is set. After that the animation will never appear again.
<TextBox HorizontalAlignment="Left" Height="23" Margin="10,178,0,0" TextWrapping="Wrap" Text="{Binding price}" VerticalAlignment="Top" Width="120" x:Name="ChangeField">
<TextBox.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding price, Converter={StaticResource formatter}}" Value="positive">
<DataTrigger.EnterActions>
<StopStoryboard BeginStoryboardName="pos"></StopStoryboard>
<BeginStoryboard x:Name="pos">
<Storyboard>
<ColorAnimation AutoReverse="True" To="Green" Duration="0:0:0:0.100" Storyboard.TargetProperty="(TextBox.Background).(SolidColorBrush.Color)"></ColorAnimation>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<RemoveStoryboard BeginStoryboardName="pos"></RemoveStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
It is possible that the price changes a few times per second, so i need to abort the running animation when a new price value is set.