private PathGeometry GetPathGeometry(Point position) { PathGeometry geometry = new PathGeometry(); ConnectOrientation targetOrient; if (HitPin != null) { targetOrient = HitPin.Orientation; } else { targetOrient = ConnectOrientation.None; } List <Point> pathPoints = PathFinder.GetConnectionLine(srcPin.GetInfo(), position, targetOrient); if (pathPoints.Count > 0) { PathFigure figure = new PathFigure(); figure.StartPoint = pathPoints[0]; pathPoints.RemoveAt(0); figure.Segments.Add(new PolyLineSegment(pathPoints, true)); geometry.Figures.Add(figure); } return(geometry); }