protected override Freezable CreateInstanceCore() { double v = velocity; double s = From; double f = To; var instance = new VelocityDrivenAnimation() { parent = this, From = From, To = To, velocity = velocity }; return(instance); }
public ZoomableImage() { InitializeComponent(); DataContext = this; smoothZoom = new VelocityDrivenAnimation(); smoothZoom.From = 1.0; smoothZoom.To = 1.0; smoothZoom.Duration = new Duration(TimeSpan.FromSeconds(0.1)); smoothZoomStoryboard = new Storyboard(); smoothZoomStoryboard.Children.Add(smoothZoom); smoothZoomStoryboard.SlipBehavior = SlipBehavior.Grow; Storyboard.SetTarget(smoothZoom, this); Storyboard.SetTargetProperty(smoothZoom, new PropertyPath(ZoomableImage.ZoomProperty)); }