WPF: Comment animer le changement de couleur?

J'ai une grille, une fenêtre de l'élément racine. Je veux appliquer une animation qui allait changer de couleur du blanc au vert en 5 secondes. Voici ce que j'ai fait:

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    ColorAnimation animation;

    animation = new ColorAnimation();
    animation.From = Colors.White;
    animation.To = Colors.Green;
    animation.Duration = new Duration(TimeSpan.FromSeconds(5));
    rootElement.BeginAnimation(Grid.BackgroundProperty, animation);
}

Le code ne fonctionne pas. Rien n'est en train de changer. Où suis-je fait une erreur? Merci.

OriginalL'auteur Boris | 2010-12-30