WPF: Detect when Window loses focus

How do I detect when my window loses focus?


Use the Window.Deactivated event.

You may be looking for the Application.Deactivated event, which fires only if the user switched to a different application.