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
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?
Hello,
I am afraid this doesn't change the behaviour.
Rather than insert(0,... , do an Add() and set the sleep timeout to 500 ms and let the app run for 30 seconds, until the list needs scrolling. Scroll up/down several times and you will see that the animation is applied to recycled cells.
Regards,
Florian Doyon
Hello Ben.
This is by design. The reason it is happening is that by default we recycle record presenters which means the way the storyboards are specified they won't get re-started.
In order to get this to work set the xamDataGrid's recordContainerGenerationMode to 'Virtualize'and set useNested panels to true, e.g.:
<igDP:XamDataGrid ...
RecordContainerGenerationMode
="Virtualize">
<igDP:XamDataGrid.ViewSettings>
<igDP:GridViewSettings UseNestedPanels="True"/>
</igDP:XamDataGrid.ViewSettings>
Please let me know if there is anything else I can do for you.
Sincerely,CharlieSenior Developer Support EngineerMCTS
We are having the same issues with the 2010.2 release in production apps.
Has this problem been fixed in 2010.3 or 2010.3 WPF Service Release ?
Best regards,
We have logged this issue as a bug with TFS #59825.
Sincerely,
CharlieSenior Developer Support EngineerMCTS
Hi Steve,
Thanks for your reply. I had a look at your code and it's slightly different to the way we're doing things. I've re-created the project (I had to use vs2008) and have managed to create the same behaviour that we're seeing. As far as I can tell it's something to do with the way that the records are added.
Can you see if I'm doing something wrong or if there's something I can do to get around the problem? I've attached my project.
Thanks
Ben