WPF初学者......
请解释为什么此XAML文档中的第三个路径未在窗口中呈现。第一个和第二个路径按原样呈现,但第三个路径不呈现。
<Canvas>
<Path Stroke="Blue" StrokeThickness="5" Canvas.Top="20">
<Path.Data>
<PathGeometry>
<PathFigure StartPoint="10, 10">
<BezierSegment Point1="130,30" Point2="40,140" Point3="150,150"></BezierSegment>
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>
<Path Stroke="Green" StrokeThickness="2" StrokeDashArray="5 2" Canvas.Top="20">
<Path.Data>
<GeometryGroup>
<LineGeometry StartPoint="10,10" EndPoint="130,30"></LineGeometry>
<LineGeometry StartPoint="40,140" EndPoint="150,150"></LineGeometry>
</GeometryGroup>
</Path.Data>
</Path>
<!-- This path is not being rendered for some reason -->
<Path Fill="Red" StrokeThickness="8" Canvas.Top="20">
<Path.Data>
<GeometryGroup>
<EllipseGeometry Center="130 30"></EllipseGeometry>
<EllipseGeometry Center="40 140"></EllipseGeometry>
</GeometryGroup>
</Path.Data>
</Path>
</Canvas>
答案 0 :(得分:1)
您缺少Stroke =&#34; Red&#34;:
<Path Fill="Red" Stroke="Red" StrokeThickness="8" Canvas.Top="20">
<Path.Data>
<GeometryGroup>
<EllipseGeometry Center="130 30"></EllipseGeometry>
<EllipseGeometry Center="40 140"></EllipseGeometry>
</GeometryGroup>
</Path.Data>
</Path>
你也可以这样试验:
<Path Fill="Blue" Stroke="Red" StrokeThickness="2" Canvas.Top="20">
<Path.Data>
<GeometryGroup>
<EllipseGeometry Center="130 30" RadiusX="5" RadiusY="5"></EllipseGeometry>
<EllipseGeometry Center="40 140" RadiusX="5" RadiusY="5"></EllipseGeometry>
</GeometryGroup>
</Path.Data>
</Path>