Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
Animate Row in XamDataGrid based on DataTrigger odd behaviour
posted

I'm trying to animate a row in a XamDataGrid so that each time an item is updated (using a DataTrigger) the animation starts. The animation continutes until the end of the storyboard.

I've managed to get the animation to start when the first item is added but when a new item is added to the grid the animation stops. Then when another item is added, the animation which stopped continutes in another row.

eg.

row1 - animating for 10 seconds

after 5 seconds (i.e. before the 10 seconds is up)

row1 - animation has stopped

row2 - animation for 10 seconds

after a further 5 seconds

row1 - no animation

row2 - animation has stopped

row3 - animation for 10 seconds

after a further 5 seconds

row1 - no animation

row2 - animation FOR ROW1 restarted here from where it stopped!!!!*******

row3 - animation has stopped

row4 - animation for 10 seconds

 

I've tried a similar approach on a simple listbox and the animations work as expected. Below is the snippet of Xaml I'm using.

<Style TargetType="{x:Type igDP:DataRecordCellArea}">

 

 

 

<Setter Property="BackgroundHover" Value="{StaticResource GridHoverBackground}"/>

 

 

 

<Setter Property="BackgroundSelected" Value="Transparent"/>

 

 

 

<Setter Property="BackgroundActive" Value="Transparent"/>

 

 

 

<Setter Property="Background">

 

 

 

<Setter.Value>

 

 

 

<SolidColorBrush Color="Transparent" />

 

 

 

</Setter.Value>

 

 

 

</Setter>

 

 

 

 

<Style.Triggers>

 

 

 

<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.UpdatedAt, Converter={StaticResource IsNotNullToBooleanConverter}}" Value="True">

 

 

 

<DataTrigger.EnterActions>

 

 

 

<BeginStoryboard>

 

 

 

<Storyboard>

 

 

 

<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="Background.Color" RepeatBehavior="1x" FillBehavior="HoldEnd" Duration="0:0:18">

 

 

 

<ColorAnimationUsingKeyFrames.KeyFrames>

 

 

 

<LinearColorKeyFrame Value="Red" KeyTime="0:0:0" />

 

 

 

<LinearColorKeyFrame Value="Orange" KeyTime="0:0:4" />

 

 

 

<LinearColorKeyFrame Value="Yellow" KeyTime="0:0:8" />

 

 

 

<LinearColorKeyFrame Value="Green" KeyTime="0:0:12" />

 

 

 

<LinearColorKeyFrame Value="Transparent" KeyTime="0:0:16" />

 

 

 

</ColorAnimationUsingKeyFrames.KeyFrames>

 

 

 

</ColorAnimationUsingKeyFrames>

 

 

 

</Storyboard>

 

 

 

</BeginStoryboard>

 

 

 

</DataTrigger.EnterActions>

 

 

 

</DataTrigger>

 

 

 

</Style.Triggers>

 

 

 

</Style>

Is there anything that I'm doing wrong?