views:

129

answers:

0

Hi I'm trying to make some rows of a DataGrid blink from white to red depending on their status.

So, I have tried this: (e.row is the current row Im trying to make blink)

Storyboard PendingStory = new Storyboard();
                ColorAnimation PendingColorAnim = new ColorAnimation();
                System.Windows.Duration PendingDuration = new System.Windows.Duration(TimeSpan.FromSeconds(0.5));
                PendingColorAnim.Duration = PendingDuration;

                PendingColorAnim.To = Color.FromArgb(255, 0, 0, 255);

                PendingStory.Duration = PendingDuration;
                PendingStory.Children.Add(PendingColorAnim);
                PendingColorAnim.RepeatBehavior = RepeatBehavior.Forever;

                Storyboard.SetTarget(PendingColorAnim, e.Row);
                Storyboard.SetTargetProperty(PendingColorAnim, new PropertyPath("(DataGridRow.Background)"));
                e.Row.Resources.Add("PendingStory", PendingStory);

                PendingStory.Begin()

Any Ideas of what im Doing Wrong? For starters I know the Path is not right so this might be the only issue pending to resolve