WPF - HitTest radius around Polyline/Path

Viewed 256

I have a thin 1px wide line on a canvas, I want an area around the line (eg 5 pixels wide) to be hit testable.

<Polyline Points="10,10,50,50,90,10,130,50,170,10,210,50,250,10" StrokeThickness="1">
  <Polyline.Style>
    <Style TargetType="Polyline">
      <Setter Property="Stroke" Value="Magenta"/>
      <Setter Property="StrokeThickness" Value="1"/>
      <Style.Triggers>
        <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="Stroke" Value="Blue" />
        </Trigger>
    </Style.Triggers>
    </Style>
  </Polyline.Style>
</Polyline>

Example code above has a difficult to hit polyline.
I don't want to add a Border around the polyline (Makes all areas inside the line hittable).
Setting the Fill property doesn't work for straight lines and makes (some) areas inside the line hittable...

1 Answers
Related