WPF / Windows Forms MDI Application

I have an existing Windows Forms mdi application to which we need to add some wpf windows.

Is there a technique to make the wpf windows children of the windows forms MDI parent?

[192 byte] By [DanaNurs] at [2008-1-4]
# 1

If you search the forums, you should find references to setting parents of controls. In theory you could set the parent of the WPF form that pops up to the MDI parent -- but it's unlikely to behave properly, as it's not really an MDI form and the WinForm MDI host won't be aware of it. I'd stay away from that unless you find that someone else has had good success.

More likely to succeed would be to host the content of the WPF window in an ElementHost (System.Windows.Forms.Integration) control. So you'd need to create an empty WinForm MDI form, add an ElementHost on that as a child, and then host the WPF content inside. If you used a UserControl for example instead of a WPF Window, you may have slightly better luck. If you want to use the same controls in a WPF application, you'd create a Window wrapper for that host.

I'd expect the second option to work -- although it's hard to know with some of these types of integrations.

WPCoder at 2007-10-11 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...

Visual Studio Orcas

Site Classified