We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Animation firing when grid scrolls

I've got an SFDatagrid that runs an animation when cell contents are changed using a style:

        <Style x:Key="currRunDataCellStyle"  TargetType="TextBlock">
            <Setter Property="Background" Value="#FFC5D9F1" />
            <Style.Triggers>
                <EventTrigger RoutedEvent="Binding.TargetUpdated">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <!--Change the cell colour (of the one being updated) from Red to Normal-->
                                <ColorAnimation Duration="0:0:2" Storyboard.TargetProperty="Background.Color" From="Red" To="#FFC5D9F1" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </Style.Triggers>
        </Style>

The only problem is that the animation fires when I scroll the grid as well. The data hasn't changed, but the animation still kicks off. Is there anyway to stop the grid from doing this?

Cheers,

Rob

1 Reply

DR Deepak Raj Sundar Syncfusion Team August 8, 2014 01:31 PM UTC

Hai Rob,
The  reported problem of animation firing while scrolling the grid occurs because, in the grid  we are reusing the Gridcell and the datacontext will change for cells each time we scroll. so its like updating the cell vale  . You can achieve the animation while changing cell value alone and not while scrolling by writing behavior for the grid. Please refer the sample program attached.

Attachment: CellAnimation_Collection_behavior_944d24f0.zip

Loader.
Live Chat Icon For mobile
Up arrow icon