I have a 700w x 300h WPF applciation and can drag it anywhere on my large screen.
When my application executes:
MessageBox.Show(\"Sorry, this functio
If you're open to using external libraries, one option is the Xceed WPF Toolkit which has a MessageBox that will center properly. It is also very consistent with WPF in general, e.g. it can be styled from XAML.
https://github.com/xceedsoftware/wpftoolkit/wiki/MessageBox
Usage
The MessageBox mimics the behavior of the System.Windows.MessageBox closely. You use similar syntax to create and show a message box.
MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show("Hello world!", "Extended WPF ToolKit MessageBox", MessageBoxButton.OK, MessageBoxImage.Question); MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show("Hello world!", "Extended WPF ToolKit MessageBox", MessageBoxButton.OK); MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show("Hello world!", "Extended WPF ToolKit MessageBox"); MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show("Hello world!");
The centering on parent window appears to be automatic.