Re: Passing a Form as owner to System.Windows.MessageBox.Show()

2010-11-17 Thread Matt Siebert
In most of these cases I have my WPF user controls binding to commands on my view models and passing the UserControl or Window they're in as a parameter (via FindAncestor). I have a couple of utility methods that the view models can then call to set the owner for a given Window based on whatever i

RE: Passing a Form as owner to System.Windows.MessageBox.Show()

2010-11-17 Thread Greg Keogh
Matt, did you ever find a way of getting the WPF Window for a WPF control hosted inside a parent Form? Sorry, it was the reverse of what I had in mind. In my earlier Apps that were hybrids like yours I was lazy and avoided the problem by having the WPF children send a message to the parent Form

Re: Passing a Form as owner to System.Windows.MessageBox.Show()

2010-11-07 Thread Matt Siebert
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 F

RE: Passing a Form as owner to System.Windows.MessageBox.Show()

2010-11-06 Thread Greg Keogh
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.MainWi