1

I have a win form application with a MDI Form.

for some reason i used a WPF Window in my application. so i want to ask how can i set WPF window parent to my MDI Form?

KF2
  • 9,887
  • 8
  • 44
  • 77

2 Answers2

2

The following code should give you the ability to set the owner of the wpf dialog to your win form.

public static void SetOwner(System.Windows.Forms.Form owner, System.Windows.Window wpfWindow)
    {
        WindowInteropHelper helper = new WindowInteropHelper(wpfWindow);
        helper.Owner = owner.Handle;
    }
Dan Carlstedt
  • 311
  • 2
  • 9
0

There is an open-source MDI implementation for WPF that you might want to look at. It may be a good bit of work and re-structuring of your code, but if you absolutely must have MDI, then that may be the best way to go forward with this - MDI for WPF.

Rohit Vats
  • 79,502
  • 12
  • 161
  • 185