wpf에서 경로를 사용할 때 새로운데 xaml 코드의 세그먼트를 C# 코드로 변환하는 방법을 모르겠습니다. 누군가가 이걸 도와 줄 수 있니? 나는 xaml 코드를 따라 간 다음 변환하려고 시도했다. C# 코드에는 무엇이 부족합니까? 내가 물어보고 싶은 또 하나의 점은 격자가 창에 표시 될 경로만큼이나 충분한 지 여부입니다. xaml을 C# 코드로 변환
<Path Stroke="Black" StrokeThickness="1">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure StartPoint="10,100">
<PathFigure.Segments>
<PathSegmentCollection>
<QuadraticBezierSegment Point1="200,200" Point2="300,100" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
내 C# 코드 :
Path myPath = new Path();
myPath.Stroke = Brushes.Black;
myPath.StrokeThickness = 1
PathGeometry myPathGeometry = new PathGeometry();
myPathGeometry.Figures = new PathFigureCollection();
PathFigure myPathFigure = new PathFigure();
myPathFigure.StartPoint = new Point(10, 100);
myPathFigure.Segments = new PathSegmentCollection();
QuadraticBezierSegment theSegment = new QuadraticBezierSegment();
theSegment.Point1 = new Point(200, 200);
theSegment.Point2 = new Point(100, 300);
myPathFigure.Segments.Add(theSegment);
myPathGeometry.Figures.Add(myPathFigure);
고마워, 알았다. 이미 데이터를 추가했지만 myGrid.Children.Add (myPath); – arjacsoh