I'm attempting to create a custom shape in WPF using a series of arc segments. The shape is essentially a circle with broken segments, something like this
whilst I know I can achieve something similar using an Ellipse and setting the dash array property, I need to deal with changing thickness and radius, i.e., I have to keep the number of visible segments constant and this becomes difficult using the dash array property since its relative to stroke thickness.
Therefore I'm attempting to create a custom shape similar to the SO question here. The shape described in that answer is only concerned with drawing a single arc whereas I need to draw a series arcs with gaps inbetween. This is what I'm attempting
for ( int i = 1; i <= Segments; i++ )
{
var endpoint = PolarToCartesian(sweepAngle * i, Radius);
var drawArcSegment = i % 2 == 0;
if (drawArcSegment)
{
var arcSegment = new ArcSegment
{
Point = endpoint,
Size = new Size(Radius, Radius),
IsLargeArc = false,
SweepDirection = SweepDirection.Clockwise
};
}
else
{
// WHAT TO DO HERE?
// Need to either draw an arc segment that can't be seen but I can't apply
// style properties to an arc segment OR need to move the current point of the
// parent path figure to a new point that is the start of the following segment
}
}
Is this possible? Am I approaching this in the right manner?