views:

47

answers:

1

Just wondering if anyone knows how I would implement additional/custom EndLineCap, StartLineCap & LineJoin attributes?

In short, LineJoin="Round" is what I want but I need both sides of the angle are smooth - instead of just the wider angled side.

Also, instead of just Rounded EndLineCap and StartLineCap I want a ball on each end (for instance, a circle at each end who's diameter is double that of the with of the line).

Instead of adding additional custom items, I might be able to achieve this through attached properties, but I don't know where to start.

A: 

I don't believe that it is possible to do what you're asking. Line Caps are implemented at a very low level in WPF where there seems to be little possibility of customisation.

The lowest level Graphics API that WPF exposes is the DrawingContext. This provides methods like DrawLine which take a Pen object to specify how LineCaps should be drawn. Your choice of LineCaps is limited to those exposed in the PenLineCap enum - it doesn't provide a "Custom" option.

Having said all that, it may be possible to emulate custom line caps by modifying the path data in a geometry. This answer may give you some hints.

Samuel Jack