Master_T
Master_T

Reputation: 7913

Problem HitTesting a geometry in WPF

My WPF application has a canvas on which I draw tables and lines that connect them. When a user clicks on a table or line, I capture the MouseDown event of that control and do various stuff in the background. The problem is that while the tables are big, and so present no problems, the lines are only a couple of pixels thick, so clicking it's difficult and annoying because you need pinpoint precision.

My question is: is there a way to give a Geometry a bit of "margin" that is invisible but still captures clicks? (or any other solution that would work for what I'm trying to achieve, maybe there's a better approach, like hit-testing on the canvas maybe??).

Thanks in advance!!

Upvotes: 1

Views: 440

Answers (1)

user180326
user180326

Reputation:

In WPF, you can draw with transparent colors (with 0 for alpha channel). If you draw an extra wide line like this below the normal one, that will respond to hittests, even though it's invisible.

Upvotes: 1

Related Questions