Missing LostKeyboardFocus event in Windows 11
When the MainWindow's LostKeyboardFocus event is triggered in my WPF (bridge) app, i.e. when the user clicks the mouse outside my app, the MainWindow will be hidden with Hide() in the LostKeyboardFocus handler. If the user clicks the app icon in the taskbar another time, the new app instance sends a message to the already existing MainWindow, whereupon it shows itself again with Show(). The new app instance will then be closed.
Unfortunately, under Windows 11, when the MainWindow is displayed again, the LostKeyboardFocus event is no longer triggered if the user clicks outside the MainWindow. However, under Windows 8.1 and under Windows 10, the LostKeyboardFocus event is triggered. Under Windows 11, only when the user clicks inside the app and then outside the app, the LostKeyboardFocus event is triggered and the MainWindow can be hidden again.
The problem occurs when I launch the app with VS 2022 under Windows 11. The problem also occurs when I create the app package under Windows 10 with VS 2017 and then sideload it under Windows 11. It works under Windows 10, but not under Windows 11.
The app is made visible as follows:
Show();
Activate();
The app has no title bar, and it is essential for the usage of the app that its window hides itself when clicked outside the app.