Search code examples
c#wpfwindowshowdialog

Preventing automatic offsetting when opening a new window


In WPF, when a new Window is shown, it is offset by maybe 10 pixels horizontally and vertically. Is there an easy way to prevent this, so the window opens directly over the one that triggered it? (They are the same size - consider it similar to an installer's behavior)


Solution

  • You should set the WindowStartupLocation property of all windows to CenterScreen value.