WPF: How do I set the Owner Window of a Dialog shown by a UserControl?
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
MyWpfDialog dialog = new MyWpfDialog();//remember, this is WinForms UserControl and its Handle property is//actually IntPtr containing Win32 HWND.new System.Windows.Interop.WindowInteropHelper(dialog).Owner = this.Handle;dialog.ShowDialog();