private void UserDrawWPF(DrawingContext dc) { if (bFound == true) { VMMainViewModel.Instance.ConvertCoordGroundToPixel(fx, fy, ref PixelX, ref PixelY); RectAnimationUsingKeyFrames n = new RectAnimationUsingKeyFrames(); n.Duration = TimeSpan.FromMilliseconds(700); n.RepeatBehavior = RepeatBehavior.Forever; n.AutoReverse = true; n.KeyFrames.Add( new LinearRectKeyFrame( new Rect(new Point(PixelX - 40, PixelY - 40), new Size(80, 80)), // Target value (KeyValue) KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(350))) // KeyTime ); n.KeyFrames.Add( new LinearRectKeyFrame( new Rect(new Point(PixelX - 25, PixelY - 25), new Size(50, 50)), // Target value (KeyValue) KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(700))) // KeyTime ); Rect rect = new Rect(new Point(PixelX - 25, PixelY - 25), new Size(50, 50)); AnimationClock myClock = n.CreateClock(); BitmapImage b = new BitmapImage(); b.BeginInit(); b.UriSource = new Uri("pack://application:,,,/images/Sight.png"); b.EndInit(); dc.DrawImage(b, rect, myClock); } }