Keeping dialogs on top of window, but not on top of everything Keeping dialogs on top of window, but not on top of everything wpf wpf

Keeping dialogs on top of window, but not on top of everything


You need to set the Owner of the Dialog/Window and it will then be on top of only that window.

For example:

var loginForm = new LoginForm();loginForm.Owner = Application.Current.MainWindow;var success = loginForm.ShowDialog();

Do not set the TopMost property on the Window otherwise it will be on top of every window.