Beispiel #1
0
 public static void AnimatePropertyFromTo(DependencyObject target, DependencyProperty property, double? fromValue, double? targetValue, int duration, DoubleAnimation animation, EventHandler animationDone, int startTime)
 {
     if (property.PropertyType != typeof(double))
     {
         throw new ArgumentException(SR.Animator_PropertyMustBeDouble, "property");
     }
     if (!(target is IAnimatable))
     {
         throw new ArgumentException(SR.Animator_TargetMustBeIAnimatable, "target");
     }
     animation.From = fromValue;
     animation.To = targetValue;
     animation.BeginTime = TimeSpan.FromMilliseconds(startTime);
     animation.Duration = TimeSpan.FromMilliseconds(duration);
     if (animationDone != null)
     {
         animation.AttachCompletedEventHandler(animationDone);
     }
     AnimateProperty(target, property, animation, animationDone);
 }