w.Owner = this;
w.Owner = Window.GetWindow(this);
To get the top level window your control is in, assuming there is one:
(Window)PresentationSource.FromVisual(this).RootVisual
To get the main window:
Application.Current.MainWindow
Reference:
http://stackoverflow.com/questions/607370/wpf-how-do-i-set-the-owner-window-of-a-dialog-shown-by-a-usercontrol
No comments:
Post a Comment