I need to draw a semicircle / half circle in WPF. Any idea how to do that? Thanks for any hint!
ArcSegment
would be a good place to start.
And here is a good example of how to use it in code.
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With