I use WPF with a ListView control.
When a certain parameter is set to True i want the row in the ListView to have a blinking animation.
I have the following code which works but the animation stops once the mouse is over the row with the animation.
I want the animation to continue until the parameter is changed back to False.
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="IsSelected" Value="{Binding Selected}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding DoBlink}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard FillBehavior="Stop">
<ColorAnimation Storyboard.TargetProperty="(Control.Background).(SolidColorBrush.Color)"
From="Blue" To="LightBlue" Duration="0:0:0.2"
AutoReverse="True" RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
</ListView.ItemContainerStyle>
This situation will require a MultiDataTrigger. Try something like this.
You will also need to use a MultiDataTrigger to stop the animation when the condition match when you would like it to stop.
EDIT: You can read about MultiDataTriggers here
EDIT 2: I have modified the code to work with a control template and added a set of conditions to stop the animation when another item is selected.
EDIT 3: Remove unneeded IsSelected condition.