مشاركة عبر


BrightnessOverride Class

Definition

BrightnessOverride allows your application to override the screen brightness level that's set for the device. With this API, you can have per-application brightness controls on devices that support controllable brightness.

You can use BrightnessOverride to override the user's brightness level setting either temporarily or permanently.

Note

When you first retrieve an initialized BrightnessOverride object from GetDefaultForSystem or from GetForCurrentView, the value of that object's BrightnessLevel property is undefined (the value doesn't, for example, represent the current system brightness level). You need to first call SetBrightnessLevel to set a brightness level.

public ref class BrightnessOverride sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 262144)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class BrightnessOverride final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 262144)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class BrightnessOverride
Public NotInheritable Class BrightnessOverride
Inheritance
Object Platform::Object IInspectable BrightnessOverride
Attributes

Windows requirements

Device family
Windows 10 Creators Update (introduced in 10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v4.0)

Properties

BrightnessLevel

Gets the screen brightness level for this BrightnessOverride instance (if you've previously called SetBrightnessLevel to set the brightness level).

Note

When you first retrieve an initialized BrightnessOverride object from GetDefaultForSystem or from GetForCurrentView, the value of that object's BrightnessLevel property is undefined (the value doesn't, for example, represent the current system brightness level). You need to first call SetBrightnessLevel to set a brightness level.

IsOverrideActive

BOOLEAN value that indicates whether the brightness override is active. If TRUE, the current brightness level matches the override brightness level. This property value will always be FALSE if StartOverride() isn’t called.

IsSupported

Indicates whether the device currently has at least one brightness controllable display. If TRUE, the device has at least one brightness controllable display that supports brightness override.

Methods

GetDefaultForSystem()

Returns a brightness override object. This method does not require CoreWindow so it can be used by apps that are running in the background.

GetForCurrentView()

Returns a BrightnessOverride object. This method requires CoreWindow, so it can be used only by apps that are currently running in a window. The returned brightness override object might not be the same between multiple calls to BrightnessOverride.GetForCurrentView on the same thread.

You must call BrightnessOverride.GetForCurrentView from the main UI thread.

GetLevelForScenario(DisplayBrightnessScenario)

Gets the brightness level associated with the specified scenario.

SaveForSystemAsync(BrightnessOverride)

Saves the specified brightness override settings by committing these values to user settings. Use this method to persist the override settings after overriding stops. If null is passed for value, then the system turns on auto-brightness.

SetBrightnessLevel(Double, DisplayBrightnessOverrideOptions)

Sets the brightness level and the override options. When your app is ready to change the current brightness with what you want to override it with, call StartOverride.

SetBrightnessScenario(DisplayBrightnessScenario, DisplayBrightnessOverrideOptions)

Sets the brightness level, by specifying a scenario that has a well-known brightness level, and the override options of the brightness override.

StartOverride()

Request to start overriding the screen brightness level. The request to start overriding does not mean that the screen brightness level always changes to match the specified override brightness level. It's still up to the system to decide whether or not to honor this override request. Use IsOverrideActive and IsOverrideActiveChanged properties to determine if the system has honored the override request.

StopOverride()

Stops overriding the brightness level.

Events

BrightnessLevelChanged

Occurs when the screen brightness level changes.

IsOverrideActiveChanged

Occurs when the screen brightness level either starts to match or stops to match the override brightness level. This event is raised when the IsOverrideActive property changes state.

IsSupportedChanged

Occurs when a brightness controllable display is detected or removed. This event is raised when the IsSupported property changes.

Applies to