Reputation: 1344
How would I go about opening a winform from a wpf application? This needs to be done through code, but the normal function
Form.Show();
will not work. I need something that will allow me to change the visibility of the form, but I am not able to access any of the gui related functions within this form.
Upvotes: 3
Views: 6286
Reputation: 564851
You can work with the Windows Form the same way in a WPF application as you would from a Windows Forms application, provided you have the proper references. This should work fine:
YourForm form = new YourForm();
form.Show();
However, I would typically recommend trying to rework this to include the Windows Forms content as a UserControl within a WPF Window using a WindowsFormsHost control. This tends to be a little cleaner, since the window parenting works a bit more cleanly (since they're all WPF windows).
Upvotes: 3