Solved!
private void Window_Loaded(object sender, RoutedEventArgs e) { SolidColorBrush rootElementBrush; ColorAnimation animation; rootElementBrush = this.FindResource("RootElementBrush") as SolidColorBrush;
Here is an explanation:
My initial mistake was that I wanted to change the Grid.BackgroundProperty by assigning colors to it, but instead it takes brushes ... apples and oranges! So, I created a static SolidColorBrush resource and named it rootElementBrush. In XAML, I set the Grid rootElement background property for this static resource. And finally, I changed the animation, so now it changes color for this SolidColorBrush . Easy!
Boris
source share