public static Point GetMousePositionRelativeTo(FrameworkElement relativeTo) { var mouseP = relativeTo.TransformToDeviceDPI(Win32Helper.GetMousePosition()); var pToScreen = relativeTo.PointToScreenDPIWithoutFlowDirection(new Point()); return(new Point(mouseP.X - pToScreen.X, mouseP.Y - pToScreen.Y)); }
public static Point GetMousePosition(FrameworkElement relativeTo) { return(relativeTo.TransformToDeviceDPI(Win32Helper.GetMousePosition())); }