Setting Focus to a WinForms Control Hosted in a WPF Window via WindowsFormsHost
You have a WPF (Windows Presentation Foundation) Window and a WinForms Control (System.Windows.Forms.Control) displayed in the WPF window using the WindowsFormsHost (System.Windows.Forms.Integration.WindowsFormsHost) adapter class.
And you'd like to set focus to the WinForms control.
It's not easy.
I’d like to say I invented this myself but I didn’t; I found it via a lot of searching the internet and finding the Chinese article below, which was cited in a StackOverflow post.
- "Looking for the hard journey of WindowsFormsHost"
(Google Translated to English)
- "Windows Forms and WPF Interoperability Input Architecture"
|Back to DELEY'S Home Page|