Thanks Greg, but the problem isn't getting the Window, I've got WPF user controls hosted on a Form (i.e. WinForms) and I can get the Form that's hosting the controls but I can't pass that as an owner to the WPF version of MessageBox.Show().
I'm using a Form instead of a Window simply because the Form behaves a little better when I set it's parent to the main window of the 3rd party program I'm interfacing with. When I have time I might look for some Win32 functions to fix up the Window behaviour so I can get rid of the Forms stuff. Until then, it seems the only other solution would be to use a custom MessageBox window that allows the owner to be specified as a Window or an IWin32Window... On Sat, Nov 6, 2010 at 8:01 PM, Greg Keogh <[email protected]> wrote: > Sorry for the late reply, > > > > I’ve had to popup MessageBox displays from various WPF components and > stumbled across a similar problem. You can ask for: > > > > Window.GetWindow(DependencyObject foo); > > > > So the argument can be a UserControl. Otherwise I use this property: > > > > Application.Current.MainWindow > > > > I’m not sure if I’ve answered your question. > > > > Greg >
