Question

I'm trying to display a WPF Path-Object with the following requirements:

  1. I want to have the Path itself displayed in a specific color and a specific thickness.
  2. I want to color the outline of the Path with another color and thickness

Example (in real life the figure is more complex, with curves etc.):

Example

Is there any way to achieve this effect in WPF?

I tried to overlay two separate Path (red Path on top of blue Path), but the result does not look very smooth, especially when you have rounded corners.

I also tried using a DropShadowEffect, but couldn't get a clear outline like in the example.

Any idea?

Thanks!

Was it helpful?

Solution

enter image description here

created by

<Canvas>
    <Canvas.Resources>
        <Geometry x:Key="pathData">M100,100 L200,100 200,150 A1,1 0 0 1 100,150 Z</Geometry>
    </Canvas.Resources>
    <Path Stroke="Blue" StrokeThickness="15" StrokeLineJoin="Round"
          Data="{StaticResource pathData}"/>
    <Path Stroke="Red" StrokeThickness="6" StrokeLineJoin="Round"
          Data="{StaticResource pathData}"/>
</Canvas>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top