Thread: Drawing a Polygon line by line using pointAnimation

  1. #1
    Registered User
    Join Date
    Nov 2016
    Posts
    3

    Drawing a Polygon line by line using pointAnimation

    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);

  2. #2
    Registered User
    Join Date
    Nov 2016
    Posts
    3
    The error that pops out after entering the coordinates:
    An unhandled exception of type 'System.InvalidOperationException' occurred in PresentationFramework.dll

    Additional information: Cannot resolve all property references in the property path 'Point'. Verify that applicable objects support the properties.

  3. #3
    Registered User
    Join Date
    Nov 2016
    Posts
    3
    Is it possible? need help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 06-07-2012, 02:50 AM
  2. Replies: 7
    Last Post: 12-13-2010, 02:13 PM
  3. Length of line..in polygon
    By zap_hax in forum C++ Programming
    Replies: 5
    Last Post: 03-29-2006, 08:49 AM
  4. Drawing a line
    By Homunculus in forum Windows Programming
    Replies: 6
    Last Post: 03-19-2006, 04:32 PM
  5. Need help with drawing a line
    By dv007 in forum C Programming
    Replies: 3
    Last Post: 06-25-2002, 01:10 PM

Tags for this Thread