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.
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.