My WPF application has windows that are running on separate dispatchers. I need to be able to tell those windows to开发者_运维知识库 activate when the main window has focus. What event should I listen too to know when the application has focus?
Application.Activated
event is a good place. When you get this event, your application has been activated by the user (either mouse click or keyboard focus switched to it).
It's not clear from the question if you want to know about the application getting focus (in which case, Franci is right) or when the main window gets focus. For the main window (or any particular window), there is a GotFocus event inherited from UIElement http://msdn.microsoft.com/en-us/library/system.windows.uielement.gotfocus.aspx
精彩评论