Alex Rivera | Logout

How do I get the current mouse screen coordinates in WPF?

Asked 2010-11-19T15:57:42.427
85

How to get current mouse coordination on the screen? I know only Mouse.GetPosition() which get mousePosition of element, but I want to get the coordination without using element.

Edit
Report

1 Answer

35

Do you want coordinates relative to the screen or the application?

If it's within the application just use:

Mouse.GetPosition(Application.Current.MainWindow);

If not, I believe you can add a reference to System.Windows.Forms and use:

System.Windows.Forms.Control.MousePosition;
answered 2010-11-19T16:19:29.810

Your Answer