private void AnimateRectangleColor(Brush Before, Brush After, double Duration, Rectangle Item, DependencyProperty Property) { if (ba != null) { item.BeginAnimation(Shape.FillProperty, null); item.Fill = af; ba = null; } ba = new Utils.AnimationHelper.Brush(); item = Item; af = After; Item.Fill = Before; ba.Storyboard.Completed += Storyboard_Completed; ba.Animation.FillBehavior = FillBehavior.Stop; PropertyPath pp = new PropertyPath("(0).(1)", Property, SolidColorBrush.ColorProperty); ba.Animate(Before, After, Duration, Item, pp); }