简体   繁体   中英

WPF window doesn't get focus

I'm having a problem where my main application window keeps the focus after a non-modal window is initiated from it. It seems at first glance that it might be the hollow windows issue with WPF (we use transparent backgrounds), but the window doesn't even have focus at all (this.IsFocused STAYS false).

As soon as you click on the window, the click goes through to the main window behind it. After which, if the window is activated from the windows taskbar, the window has focus, can be activated, and accepts all clicks.

I've tried taking focus from the window itself, with API calls, trying to simulate the clicks, the whole toot.

What I think might be happening is that somewhere, something else is keeping focus on the main window once the child window is generated (this is NOT an MDI environment). Is there some application that allows me to check which WPF element has focus, or somehow makes it possible for me to trace the focus in the application? I've tried snoop, and it doesn't play well with our app (makes it fall over).

Any other ideas or suggestions would be greatly appreciated.

This may be a known issue with RPC services, it cannot be fixed and it is not your code fault. Reboot your system and try again this scenario.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM