WPF: Detect when Window loses focus

Wpf

Wpf Problem Overview


How do I detect when my window loses focus?

Wpf Solutions


Solution 1 - Wpf

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJonathan AllenView Question on Stackoverflow
Solution 1 - WpfSLaksView Answer on Stackoverflow