I\'m trying to create a custom shape with WPF. For starters I was just trying to create a simple line, that has a circle at each end (I know there are LineCaps, but that\'s
Your LineGeometry
objects will vanish if you try to Union
them. From MSDN:
The GeometryCombineMode property specifies how the two geometries will be combined. Note that CombinedGeometry combines the area specified by two geometries, so geometries that do not have area (such as LineGeometry) disappear when combined.
You can use GeometryGroup
:
GeometryGroup combined = new GeometryGroup();
combined.Children.Add(ellipse1);
combined.Children.Add(ellipse2);
combined.Children.Add(line);
or you can use CombinedGeometry
on the ellipse objects first, and then group that together with the line using GeometryGroup
.