LockOnLeaveOptions Class


Provides the ability to manage the locking behavior of the PC screen based on whether a user is detected by the human presence sensor.

public ref class LockOnLeaveOptions sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 983040)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class LockOnLeaveOptions final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 983040)]
public sealed class LockOnLeaveOptions
Public NotInheritable Class LockOnLeaveOptions
Object Platform::Object IInspectable LockOnLeaveOptions

Windows requirements

Device family
Windows 11, version 22H2 (introduced in 10.0.22621.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v15.0)


Introduced in the May Moment update for Windows 11, Version 22H2, Build 22621.

The user can specify their preferred lock on leave behavior in the System settings (see Launch the Windows Settings app).



Gets or sets whether lock on leave behavior is enabled when an external monitor is connected to the system.

Applies to

See also