I am creating a simple WPF application. I have transparent maximized Window and a Canvas (canvas1).
I want to get the mouse position in canvas1 or in MainWindow (in this case it is the same).
For this, I use this code:
Point p = Mouse.GetPosition(canvas1); //and then I have pX and pY
This code works great for an opaque Canvas . The problem is that I have a transparent Canvas , and this code does not work ... (This does not give me errors, but the coordinates are pX = 0 and pY = 0 ).
How can I fix this problem?
Ionicฤ Bizฤu
source share