user1373186
user1373186

Reputation: 101

Hosting MDI .NET Winform in WPF web application

I have a legacy .NET/C# MDI application which needs to be hosted inside a WPF application. I tried by adding the MDI parent form to the Child of System.Windows.Forms.Integration.WindowsFormsHost but an exception was thrown with the error message:

$exception
{"The child control cannot be a top-level form."}
System.Exception {System.ArgumentException}

and MDI parent's TopLevel attribute must be set to true.

Is MDI WinForm supported with WPF interop?

Upvotes: 1

Views: 1060

Answers (1)

user2088633
user2088633

Reputation: 11

Don't know if you are still looking for a solution but I had the same problem and solved it by following this example

http://shevaspace.blogspot.nl/2007/02/how-to-host-top-level-hwnds-in-wpf.html

Basically you have write your own HwnDHost control (WindowsFormHost uses that aswell)

Hope it helps people with the same problem

Upvotes: 1

Related Questions