Good day.

I have a problem with creating my component via HwndHost. So it turns out that I cannot use Windows FormsHost due to the multithreading of the application. If anyone knows, please tell me how to properly disable the focus transfer from HwndHost to the WPF window, so that the focus is not dropped from my component, but remains on it when you click on the WPF window. I saw a workaround on the Internet, but it was that after removing the focus, he then went back (but this does not suit me, since he resets the mode of my component (browser)). Here is what is happening:

alt text

    1 answer 1

    Everything turned out to be much more complicated. Following the example, I placed the necessary component in a window specially created through winapi. To achieve the desired behavior, I installed various functions and attributes, but nothing helped. When I found a better example (where it wasn’t necessary to do this at all), I installed the component itself as the host. Also, to prevent focusing, I did not forget to set WPF IsFocusable = False on the WPF IsFocusable = False element.

    ZY Already, my component is one level better than native WPF WebBrowser, although it has a few lines of code).