I play with a simple WPF application. One part of it contains a grid containing several controls. The grid is rotated using LayoutTransform and RotateTransform. I need to get the coordinates of the mouse click relative to the upper left edge of the grid, taking into account the rotation.
To be clear, let's say I have one drawing surface inside the grid, and no transformation has been applied. Then I click at the point X = 20, Y = 10 and place the point on the drawing surface at that point. If the grid is now rotated 30 degrees, and I click on a point (which also moves in rotation), the position of the click should be equal to X = 20, Y = 10.
source
share