The current implementation for "Blur codes" only blurs them when unfocused, other programs can still take a screenshot and get the code if the program is on foreground.
Switching to this property would not only disable screen capture even when the app is on foreground, but also simplify the codebase since background detection is no longer required.
The current implementation for "Blur codes" only blurs them when unfocused, other programs can still take a screenshot and get the code if the program is on foreground.
However Microsoft has provided ApplicationView.IsScreenCaptureEnabled property for screen capture disabling.
Switching to this property would not only disable screen capture even when the app is on foreground, but also simplify the codebase since background detection is no longer required.
Here is the sample code: windows-universal-samples/Samples/DisablingScreenCapture