I have an application that will mainly operate in the background. I want certain system events that it handles to cause the app to steal focus from the foreground app, whatever that is. But UIElement.Focus() seems to only set the focus within the WPF app. That is, if the WPF app already has the focus as a whole, then Focus() sets the focus to the right control. But I need to steal focus from another app and put it on my app. How can I do this?
I do not want a system modal dialog. That is, after the window steals focus, it should be possible for the user to immediately switch to another app without dismissing my app's window.
The app may already been in a restored, minimized, or even "minimize to tray" state when it needs to steal system focus. So assuming that it is minimized and stealing focus while restoring the window is not acceptable.