private Action<Action> AnimateItem(AnimatedMapItem item, Point from, Point to) { return completed => { PointAnimation pointAnimation = new PointAnimation() { Duration = TimeSpan.FromMilliseconds(300), From = from, To = to, }; Storyboard.SetTarget(pointAnimation, item); Storyboard.SetTargetProperty(pointAnimation, new PropertyPath("Point")); this.storyboard = new Storyboard() { AutoReverse = false, }; storyboard.Completed += this.Storyboard_Completed; storyboard.Children.Add(pointAnimation); storyboard.Begin(); }; }
private void AnimateRouteButtonClick(object sender, RoutedEventArgs e) { if (this.routeLayer.Items.Count > 0) { PolylineData routeLine = this.routeLayer.Items[0] as PolylineData; if (routeLine != null && routeLine.Points.Count > 1) { this.SetIsEnabled(false); this.animatedItems.RemoveAll(); AnimatedMapItem item = new AnimatedMapItem() { Caption = DateTime.Now.ToString(), Location = routeLine.Points[0] }; this.animatedItems.Add(item); this.animationActions = this.AnimationSequence().GetEnumerator(); this.RunNextAction(); } } }