Search code examples
c#wpfsilverlightxaml

XAML Path element - how to make soft corners


I'm trying to figure out how to set Data property of the Path element to get soft corners of this type:

alt text

Right now I have only sharp corners like this:

alt text

I tried playing with ellipses, but I can't get what I want.

Thanks


Solution

  • Segments of a path have a IsSmoothJoin property, defaulting to false. I have never tried it but it seems to be a good candidate.

    Another idea is to use a PolyLine (instead of a Path, if that's OK in your case). PolyLine has the StrokeLineJoin property, of type PenLineJoin, which allow for rounded corners. See MSDN, under Strokes, for the possibilities.

    Edit: added the following: Actually, the StrokeLineJoin property comes from the Shape class, and Path is a subclass of Shape, so you can use this property directly in the Path instance.