I have a 700w x 300h WPF application and can drag it anywhere on my large screen.
When my application executes:
MessageBox.Show("Sorry, this function is not yet implemented.");
the mesage box appears in the middle of my screen, which may or may not even be near the application itself.
How can I get my MessageBox to appear in the middle of my application instead?
If your app has several windows, you might want to use Application.Current.MainWindow
:
MessageBox.Show(Application.Current.MainWindow, "Can't login with given names.", "Login Failure", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.Cancel);