0

i want to use animation to move an object in WPF. what i know to do that is From and To property but its not working because they take type double and Margin is type Thickness. i also used SetValue as u see

            DoubleAnimation lockation = new DoubleAnimation();
        lockation.SetValue(MarginProperty, new Thickness(423, 219, -5, -5));
        lockation.Duration = new Duration(TimeSpan.FromMilliseconds(100));
        image.BeginAnimation(Image.MarginProperty, lockation);

but its not working too. what should i do?

DiniMad
  • 49
  • 1
  • 9
  • If your Image is in a Canvas, you may also consider animating the Canvas.Left and Canvas.Top properties, which are of type double. – Clemens Oct 22 '17 at 09:14
  • If you want to animate a Thickness, use a [ThicknessAnimation](https://msdn.microsoft.com/en-us/library/system.windows.media.animation.thicknessanimation(v=vs.110).aspx) – Steven Rands Oct 23 '17 at 14:22

0 Answers0