效果图预览 新建MyCustomControl类。 public class MyCustomControl : Control { private static Storyboard MyStory; private ObjectAnimationUsingKeyFrames MyAnimation; private List<BitmapImage> ImageList; private UIElement animation; public static readonly DependencyProperty DurationProperty = DependencyProperty.Register("Duration", typeof(TimeSpan), typeof(MyCustomControl), new PropertyMetadata(null)); /// <summary> /// 动画时间 /// </summary> public TimeSpan Duration { get { return (TimeSpan)GetValue(DurationProperty); } set { SetValue(DurationProperty, value); } } public static readonly DependencyProperty