Reputation: 17786
I need to draw a semicircle / half circle in WPF. Any idea how to do that? Thanks for any hint!
Upvotes: 6
Views: 13345
Reputation: 4847
Since the original link is dead, here's how I was able to draw an arc:
<Canvas>
<Path Stroke="Gray">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure StartPoint="0,20">
<PathFigure.Segments>
<PathSegmentCollection>
<ArcSegment Size="20, 20"
IsLargeArc="True"
SweepDirection="CounterClockwise"
Point="40,20" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
</Canvas>
That produces the following image (with added markings for some of the variables)
The XAML above is a modified version of the XAML found here:
https://www.c-sharpcorner.com/UploadFile/mahesh/drawing-arc-using-arcsegment-in-xaml/
Upvotes: 9