// set Owner property
w.Owner = Window.GetWindow(this);
// or
w.Owner = this;
// or
w.Owner = Application.Current.MainWindow;
// or
w.Owner = (Window)PresentationSource.FromVisual(this).RootVisual;
w.ShowDialog();
Note: Don't forget to set the Owner property on the dialog window. Otherwise, the user will get weird behavior when Alt+Tabbing, etc.
Reference:
http://stackoverflow.com/questions/499294/how-do-make-modal-dialog-in-wpf
No comments:
Post a Comment