Tech Off Post

Single Post Permalink

View Thread: Strange WPF Textbox Problem
  • User profile image

    "Proper input interop with a non-WPF host (such as WinForms) requires some cooperation between the host and the WPF input system. The topic Sharing Message Loops Between Win32 and WPF  in the SDK explains this well. At a minimum, you have to call ComponentDispatcher.RaiseThreadMessage() from the host’s message loop. In your setup, the easiest way to make this happen is to use code like this:

       Window w = new Window1();




    ElementHost.EnableModelessKeyboardInterop() essentially registers an input hook with the WinForms Application object (which normally runs the message loop) and calls ComponentDispatcher.RaiseThreadMessage()."