How do I create a new GeometryCollection from code?
Posted: 27 Mar 2017, 18:20
I am creating a new GeometryGroup from code. It seems like I am unable to create a GeometryCollection because the method is protected. Is there a way around that??
This is what I am trying to do in code.
I am stuck. Please let me know if there is something I am not seeing.
I get the error on this line:
Children = new GeometryCollection().
I cannot access GeometryCollection due to it's protection level..So how do I add a geometry collection programatically?
Thanks!!
This is what I am trying to do in code.
Code: Select all
private Path ConstructPath()
{
if (WedgeAngle >= 360)
{
Path path = new Path()
{
Fill = this.Fill,
Stroke = this.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
}
...
I get the error on this line:
Children = new GeometryCollection().
I cannot access GeometryCollection due to it's protection level..So how do I add a geometry collection programatically?
Thanks!!