DisplayInformation DisplayInformation DisplayInformation DisplayInformation Class

Definition

Monitors and controls physical display information. The class provides events to allow clients to monitor for changes in the display.

public : sealed class DisplayInformation : IDisplayInformation, IDisplayInformation2, IDisplayInformation3, IDisplayInformation4public sealed class DisplayInformation : IDisplayInformation, IDisplayInformation2, IDisplayInformation3, IDisplayInformation4Public NotInheritable Class DisplayInformation Implements IDisplayInformation, IDisplayInformation2, IDisplayInformation3, IDisplayInformation4// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

To handle DisplayInformation events, use an event handler for the specific event. For example, for DisplayInformation.DpiChanged, use "TypedEventHandler<DisplayInformation, Object> DpiChanged."

Any property change event of DisplayInformation might trigger if your app is moved from one monitor to another monitor. ColorProfileChanged is triggered when the display’s color profile changes. DpiChanged is triggered when either the LogicalDpi or ResolutionScale property changes because a user selected a different zoom level or changed the screen resolution. OrientationChanged is triggered if a user changes the screen orientation.

Properties

AutoRotationPreferences AutoRotationPreferences AutoRotationPreferences AutoRotationPreferences

Gets and sets the preferred orientation of the app.

public : static DisplayOrientations AutoRotationPreferences { get; set; }public static DisplayOrientations AutoRotationPreferences { get; set; }Public Static ReadWrite Property AutoRotationPreferences As DisplayOrientations// You can use this property in JavaScript.
Value
DisplayOrientations DisplayOrientations DisplayOrientations DisplayOrientations

The orientation of a rectangular monitor.

Remarks

This property is static.

CurrentOrientation CurrentOrientation CurrentOrientation CurrentOrientation

Gets the current orientation of a rectangular monitor.

public : DisplayOrientations CurrentOrientation { get; }public DisplayOrientations CurrentOrientation { get; }Public ReadOnly Property CurrentOrientation As DisplayOrientations// You can use this property in JavaScript.
Value
DisplayOrientations DisplayOrientations DisplayOrientations DisplayOrientations

The current orientation of a rectangular monitor.

Remarks

The value of the DisplayInformation::CurrentOrientation property corresponds to the orientation of the display or monitor and not necessarily to the orientation of your app. To determine the orientation of your app for layout purposes, use the ApplicationView.Value property.

DiagonalSizeInInches DiagonalSizeInInches DiagonalSizeInInches DiagonalSizeInInches

Diagonal size of the display in inches.

public : IReference<double> DiagonalSizeInInches { get; }public Nullable<double> DiagonalSizeInInches { get; }Public ReadOnly Property DiagonalSizeInInches As Nullable<double>// You can use this property in JavaScript.
Value
IReference<double> Nullable<double> Nullable<double> Nullable<double>

Returns the diagonal size of the display in inches. May return null when display size information is not available or undetermined (when connected to a projector, or displays are duplicated).

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

LogicalDpi LogicalDpi LogicalDpi LogicalDpi

Gets the pixels per logical inch of the current environment.

public : float LogicalDpi { get; }public float LogicalDpi { get; }Public ReadOnly Property LogicalDpi As float// You can use this property in JavaScript.
Value
float float float float

The pixels per logical inch of the current environment.

Remarks

The logical dots per inch (DPI) can change based on scaling. For info about the meaning of logical DPI, see DPI and Device-Independent Pixels.

NativeOrientation NativeOrientation NativeOrientation NativeOrientation

Gets the native orientation of the display monitor, which is typically the orientation where the buttons on the device match the orientation of the monitor.

public : DisplayOrientations NativeOrientation { get; }public DisplayOrientations NativeOrientation { get; }Public ReadOnly Property NativeOrientation As DisplayOrientations// You can use this property in JavaScript.
Value
DisplayOrientations DisplayOrientations DisplayOrientations DisplayOrientations

The native orientation of the display monitor.

Remarks

NativeOrientation returns only the Landscape or Portrait value. NativeOrientation never returns the LandscapeFlipped or PortraitFlipped value.

RawDpiX RawDpiX RawDpiX RawDpiX

Gets the raw dots per inch (DPI) along the x axis of the display monitor.

public : float RawDpiX { get; }public float RawDpiX { get; }Public ReadOnly Property RawDpiX As float// You can use this property in JavaScript.
Value
float float float float

The raw dots per inch (DPI) along the x axis of the display monitor.

Remarks

This property can return 0 when the monitor doesn't provide physical dimensions and when the user is in a clone or duplicate multiple-monitor setup.

RawDpiY RawDpiY RawDpiY RawDpiY

Gets the raw dots per inch (DPI) along the y axis of the display monitor.

public : float RawDpiY { get; }public float RawDpiY { get; }Public ReadOnly Property RawDpiY As float// You can use this property in JavaScript.
Value
float float float float

The raw dots per inch (DPI) along the y axis of the display monitor.

Remarks

This property can return 0 when the monitor doesn't provide physical dimensions and when the user is in a clone or duplicate multiple-monitor setup.

RawPixelsPerViewPixel RawPixelsPerViewPixel RawPixelsPerViewPixel RawPixelsPerViewPixel

Gets a value representing the number of raw (physical) pixels for each view (layout) pixel.

public : double RawPixelsPerViewPixel { get; }public double RawPixelsPerViewPixel { get; }Public ReadOnly Property RawPixelsPerViewPixel As double// You can use this property in JavaScript.
Value
double double double double

A value representing the number of raw (physical) pixels for each view (layout) pixel.

See Also

ResolutionScale ResolutionScale ResolutionScale ResolutionScale

Gets the scale factor of the immersive environment.

public : ResolutionScale ResolutionScale { get; }public ResolutionScale ResolutionScale { get; }Public ReadOnly Property ResolutionScale As ResolutionScale// You can use this property in JavaScript.
Value
ResolutionScale ResolutionScale ResolutionScale ResolutionScale

The scale factor of the immersive environment.

ScreenHeightInRawPixels ScreenHeightInRawPixels ScreenHeightInRawPixels ScreenHeightInRawPixels

Returns the current height resolution of the logical monitor.

public : unsigned int ScreenHeightInRawPixels { get; }public uint ScreenHeightInRawPixels { get; }Public ReadOnly Property ScreenHeightInRawPixels As uint// You can use this property in JavaScript.
Value
unsigned int uint uint uint

Returns the current resolution of the logical monitor containing the application’s view. When the application’s view is moved to another logical monitor, this property will reflect the new logical monitor’s resolution.

Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

ScreenWidthInRawPixels ScreenWidthInRawPixels ScreenWidthInRawPixels ScreenWidthInRawPixels

Returns the current width resolution of the logical monitor.

public : unsigned int ScreenWidthInRawPixels { get; }public uint ScreenWidthInRawPixels { get; }Public ReadOnly Property ScreenWidthInRawPixels As uint// You can use this property in JavaScript.
Value
unsigned int uint uint uint

Returns the current resolution of the logical monitor containing the application’s view. When the application’s view is moved to another logical monitor, this property will reflect the new logical monitor’s resolution.

Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

StereoEnabled StereoEnabled StereoEnabled StereoEnabled

Gets a value that indicates whether the device supports stereoscopic 3D.

public : PlatForm::Boolean StereoEnabled { get; }public bool StereoEnabled { get; }Public ReadOnly Property StereoEnabled As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

TRUE if the device is capable of stereoscopic 3D and stereoscopic 3D is currently enabled; FALSE otherwise.

Methods

GetColorProfileAsync() GetColorProfileAsync() GetColorProfileAsync() GetColorProfileAsync()

Asynchronously gets the default International Color Consortium (ICC) color profile that is associated with the physical display.

public : IAsyncOperation<IRandomAccessStream> GetColorProfileAsync()public IAsyncOperation<IRandomAccessStream> GetColorProfileAsync()Public Function GetColorProfileAsync() As IAsyncOperation( Of IRandomAccessStream )// You can use this method in JavaScript.
Returns

Remarks

The asynchronous operation fails if no physical display is attached to the computer on which the app is running (for example, if the app is running over Remote Desktop Connection), if no color profile is associated with the display, or if the profile doesn't match the signature of an ICC color profile. Additionally, not all device families support returning the display's color profile; currently only the Desktop device family implements this API.

Applications should catch any exceptions thrown by this API. In these cases, there is no valid ICC color profile associated with the display, and the app should handle this by assuming a default color space such as sRGB.

GetForCurrentView() GetForCurrentView() GetForCurrentView() GetForCurrentView()

Gets the current physical display information.

public : static DisplayInformation GetForCurrentView()public static DisplayInformation GetForCurrentView()Public Static Function GetForCurrentView() As DisplayInformation// You can use this method in JavaScript.
Returns

A DisplayInformation object that contains the current physical display information.

Remarks

This method is static.

Events

ColorProfileChanged ColorProfileChanged ColorProfileChanged ColorProfileChanged

Occurs when the physical display's color profile changes.

public : event TypedEventHandler ColorProfileChanged<DisplayInformation,  object>public event TypedEventHandler ColorProfileChanged<DisplayInformation,  object>Public Event ColorProfileChanged<DisplayInformation,  object>// You can use this event in JavaScript.

Remarks

The ColorProfileChanged event is only triggered when the display’s color profile changes. You must then call the DisplayInformation::GetColorProfileAsync method to asynchronously retrieve the new color profile.

DisplayContentsInvalidated DisplayContentsInvalidated DisplayContentsInvalidated DisplayContentsInvalidated

Occurs when the display requires redrawing.

public : static event TypedEventHandler DisplayContentsInvalidated<DisplayInformation,  object>public static event TypedEventHandler DisplayContentsInvalidated<DisplayInformation,  object>Public Static Event DisplayContentsInvalidated<DisplayInformation,  object>// You can use this event in JavaScript.

Remarks

This event is static.

Because this event is static, we recommend that you directly access it from the DisplayInformation object and not from the current physical display info that you get from a call to the DisplayInformation.GetForCurrentView method.

DpiChanged DpiChanged DpiChanged DpiChanged

Occurs when the LogicalDpi property changes because the pixels per inch (PPI) of the display changes.

public : event TypedEventHandler DpiChanged<DisplayInformation,  object>public event TypedEventHandler DpiChanged<DisplayInformation,  object>Public Event DpiChanged<DisplayInformation,  object>// You can use this event in JavaScript.

OrientationChanged OrientationChanged OrientationChanged OrientationChanged

Occurs when either the CurrentOrientation or NativeOrientation property changes because of a mode change or a monitor change.

public : event TypedEventHandler OrientationChanged<DisplayInformation,  object>public event TypedEventHandler OrientationChanged<DisplayInformation,  object>Public Event OrientationChanged<DisplayInformation,  object>// You can use this event in JavaScript.

Remarks

The OrientationChanged event occurs only when orientation of the display or monitor changes and not necessarily when the orientation of your app changes. To determine the orientation of your app for layout purposes, use the ApplicationView.Value property.

StereoEnabledChanged StereoEnabledChanged StereoEnabledChanged StereoEnabledChanged

Occurs when the StereoEnabled property changes because support for stereoscopic 3D changes.

public : event TypedEventHandler StereoEnabledChanged<DisplayInformation,  object>public event TypedEventHandler StereoEnabledChanged<DisplayInformation,  object>Public Event StereoEnabledChanged<DisplayInformation,  object>// You can use this event in JavaScript.

See Also