I'm making mouse listener in wpf, and I see that I need to use WH_MOUSE, but unfortunately it generates error (I don't have it). How Do I import it to my project?
Asked
Active
Viewed 42 times
1 Answers
0
Yes, the trick is to use Brushes.Transparent for the Background
. By default, the Background
is null
, which lets you click through to the elements below. When you use Transparent
instead, the background is still see-through, but it responds to input like mouse clicks.
<Rectangle x:Name="Rect" MouseLeftButtonDown="leftDown" Fill="Transparent" Width="100" Height="100"/>

Keith Stein
- 6,235
- 4
- 17
- 36
-
Great! Thank you very much! – Omikor Feb 28 '21 at 17:19