Hi, the program asks the user to input 4 x&y coordinates and from those points a polygon will be created line by line using animations. However, my program crashes after I inputted the 4 coordinates because of my PropertyPath declaration. Any idea on what should be the declared on the PropertyPath Value?
Code:
NewPolygon = new Polygon();
NewPolygon.Stroke = Brushes.Black;
NewPolygon.StrokeThickness = 2;
Storyboard sb = new Storyboard();
PointAnimation pa1 = new PointAnimation();
pa1.From=new Point(Xone, Yone);
pa1.To = new Point(Xtwo, Ytwo);
pa1.Duration = TimeSpan.FromSeconds(2);
PointAnimation pa2 = new PointAnimation();
pa2.From = new Point(Xtwo, Ytwo);
pa2.To = new Point(Xthree, Ythree);
pa2.Duration = TimeSpan.FromSeconds(2);
PointAnimation pa3 = new PointAnimation();
pa3.From = new Point(Xthree, Ythree);
pa3.To = new Point(Xfour, Yfour);
pa3.Duration = TimeSpan.FromSeconds(2);
Storyboard.SetTargetProperty(pa1, new PropertyPath("(Xtwo, Ytwo)"));
Storyboard.SetTargetProperty(pa1, new PropertyPath("(Xthree, Ythree)"));
Storyboard.SetTargetProperty(pa1, new PropertyPath("(Xfour, Yfour)"));
sb.Children.Add(pa1);
sb.Children.Add(pa2);
sb.Children.Add(pa3);
NewPolygon.BeginStoryboard(sb);