I used System.Windows.Window.IsActive to detect whether the window is in the foreground and it worked in some cases. But I have found cases where it doesn’t and I wonder if there is any way to detect it.
I used System.Windows.Window.IsActive to detect whether the window is in the foreground and it
Share
The method below works except when a background-only process gets the focus. This is the case with the Windows Desktop. It steals the status of foreground window but it isn’t in the foreground.