Share |

Interoperability between window form and WPF

I had application running on windows form. I had some requirement which I can easily achieve with WPF. I create a WPF control and host it with windows form. My WPF control has textbox control in it. Once I execute application and trying to input value in textbox which I am not able to do. Reason win form and WPF have different keyboard and message processing.

To interoperability of WPF and windows form we can use following class:

WindowsFormsHost:
An element that allow you to host a windows form control on WPF page.

WindowsFormHost.EnableModelessKeyboardInterop() is received keyboard message correctly when it is opened modelessly from windows form.

ElementHost:
A window form control that can be used to host a WPF element.

Namespace for these classes are: system.windows.forms.integration and Assembly name is WindowsFormsIntegration. WindowsFormsIntegration.dll is installed with the WPF assemblies.

Source Code: Window Interoperability with WPF WPF interoperability with Windows form
Date:- 2 July, 2009