How to extend WPF hit testing zone for a Path object.
Posted
by user275587
on Stack Overflow
See other posts from Stack Overflow
or by user275587
Published on 2010-04-15T01:06:34Z
Indexed on
2010/04/15
1:13 UTC
Read the original article
Hit count: 453
Wpf hit testing is pretty good but the only method I found to extend the hit zone is to put a transparent padding area around your object. I can't find any method to add a transparent area arround a Path object. The path is very thin and I would like to enable hit testing if the user clicks near the path. I can't find any method to extend the path object with a transparent area like the image below :
I tried to used a partially transparent stroke brush but I ran into the problem described here : http://stackoverflow.com/questions/1412833/how-can-i-draw-a-soft-line-in-wpf-presumably-using-a-lineargradientbrush
I also tried to put an adorner over my line but because of WPF anti-aliasing algorithms, the position is way off when I zoom in my canvas and interfere with other objects hit-testing in a bad way.
Any suggestion to extend the hit testing zone would be highly appreciated.
Thanks, Kumar
© Stack Overflow or respective owner