/// <summary> /// Constructs a path that represents this pie segment /// </summary> /// <returns></returns> private Path ConstructPath() { if (WedgeAngle >= 360) { var path = new Path { Fill = Fill, Stroke = Stroke, StrokeThickness = 1, Data = new GeometryGroup { FillRule = FillRule.EvenOdd, Children = new GeometryCollection { new EllipseGeometry { Center = new Point(CentreX, CentreY), RadiusX = Radius, RadiusY = Radius }, new EllipseGeometry { Center = new Point(CentreX, CentreY), RadiusX = InnerRadius, RadiusY = InnerRadius } } } }; return(path); } var startPoint = new Point(CentreX, CentreY); var p1 = AppHelpers.ComputeCartesianCoordinate(RotationAngle, InnerRadius); p1.Offset(CentreX, CentreY); var innerArcStartPoint = p1; var p2 = AppHelpers.ComputeCartesianCoordinate(RotationAngle + WedgeAngle, InnerRadius); p2.Offset(CentreX, CentreY); var innerArcEndPoint = p2; var p3 = AppHelpers.ComputeCartesianCoordinate(RotationAngle, Radius); p3.Offset(CentreX, CentreY); var outerArcStartPoint = p3; var p4 = AppHelpers.ComputeCartesianCoordinate(RotationAngle + WedgeAngle, Radius); p4.Offset(CentreX, CentreY); var outerArcEndPoint = p4; var largeArc = WedgeAngle > 180.0; var outerArcSize = new Size(Radius, Radius); var innerArcSize = new Size(InnerRadius, InnerRadius); var figure = new PathFigure { StartPoint = innerArcStartPoint, Segments = new PathSegmentCollection { new LineSegment { Point = outerArcStartPoint }, new ArcSegment { Point = outerArcEndPoint, Size = outerArcSize, IsLargeArc = largeArc, SweepDirection = SweepDirection.Clockwise, RotationAngle = 0 }, new LineSegment { Point = innerArcEndPoint }, new ArcSegment { Point = innerArcStartPoint, Size = innerArcSize, IsLargeArc = largeArc, SweepDirection = SweepDirection.Counterclockwise, RotationAngle = 0 } } }; return(new Path { Fill = Fill, Stroke = Stroke, StrokeThickness = 1, Data = new PathGeometry { Figures = new PathFigureCollection { figure } } }); }