I'm currently trying to add a BezierSegment to my canvas for my WPF. I get a compile-time error of an invalid cast:
Argument 1: cannot be converted from "System.Windows.Media.PathGeometry" to "System.Windows.UIElement"
This is what I still have ...
//bezier curve it BezierSegment curve = new BezierSegment(startPoint, endPoint,controlPoint,false); // Set up the Path to insert the segments PathGeometry path = new PathGeometry(); PathFigure pathFigure = new PathFigure(); pathFigure.StartPoint = hs.LeStartingPoint; pathFigure.IsClosed = true; path.Figures.Add(pathFigure); pathFigure.Segments.Add(curve); System.Windows.Shapes.Path p = new Path(); p.Data = path; this.mainWindow.MyCanvas.Children.Add(path);
Any help would be greatly appreciated!
source share