I want to animate the rectangle x position from my code behind (as the x position is only determined at the run time).
I have got the following code:
KeySpline easeOut = new KeySpline(0, 1, 0.3, 1); Storyboard sb = new Storyboard(); DoubleAnimationUsingKeyFrames da1 = new DoubleAnimationUsingKeyFrames(); SplineDoubleKeyFrame keyFrame1 = new SplineDoubleKeyFrame(); GeneralTransform generalTransform = rect4.TransformToVisual(this); Point point = generalTransform.Transform(new Point()); keyFrame1.Value = point.X; keyFrame1.KeySpline = easeOut; da1.KeyFrames.Add(keyFrame1); sb.Children.Add(da1); Storyboard.SetTarget(da1, rect); Storyboard.SetTargetProperty(da1, new PropertyPath("What is the path?")); sb.Begin();
The thing I don't know is what to put for the PropertyPath?!