Question

I have something like this: canvasGraph.Children.Add(new Polyline(){Points = new PointCollection((x1, y1), (x2, y2))}); but it does not work and I don`t know how to deal with it

Was it helpful?

Solution

You are initializing your point collection the wrong way:

canvasGraph.Children.Add(new Polyline(){
  Points = new PointCollection(
    new List<Point> {
      new Point(x1, y1), 
      new Point(x2, y2)})});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top