Search code examples
c#wpfxamldatagridexpression-blend

The animation of the first row DataGrid?


Maybe someone knows the answer to my question. How to make text color of the new added row in Datagrid brighter than other rows in the first 5 seconds, and then she again became the same as all the rows? If this is done through the animation, then tell me please how?


Solution

  • You can use Expression blend to create WPF animation. It ll generate Xaml code which use the StoryBoard xaml Tag.

    You should have somthink like that code Snippet.

               <DataGrid.Triggers>
                    <EventTrigger RoutedEvent="DataGrid.MouseLeave">
                        <BeginStoryboard>
                            <Storyboard>
                                <ColorAnimation To="Red" Storyboard.TargetProperty="(your new row here ???).(SolidColorBrush.Color)" Duration="0:0:10"></ColorAnimation>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </DataGrid.Triggers>