I have a WPF-window, in this you can click a button to see a new window. Now I want to disable, that you can click the main-window. It should be like a MessageBox.
+3
A:
You want to use dialog.ShowDialog()
.
Modeless dialogs (via dialog.Show
) are ones that you can interact with the background window. Modal dialogs (via dialog.ShowDialog()
are ones that don't allow you to interact with the parent window.
Brian R. Bondy
2010-01-19 13:27:26
+2
A:
Try this:
dialogYouNeedToShow.Owner = App.Current.MainWindow;
dialogYouNeedToShow.ShowDialog();
ShowDialog will always show your dialog as a modal one, so you won't have access to background form.
Restuta
2010-01-19 13:30:14