Display​Information Display​Information Display​Information 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
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

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
Value
DisplayOrientations DisplayOrientations DisplayOrientations

The orientation of a rectangular monitor.

Attributes

Remarks

This property is static.

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
Value
DisplayOrientations DisplayOrientations DisplayOrientations

The current orientation of a rectangular monitor.

Attributes

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

Diagonal size of the display in inches.

public IReference<double> DiagonalSizeInInches { get; }public IReference<double> DiagonalSizeInInches { get; }Public ReadOnly Property DiagonalSizeInInches As IReference<double>
Value

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).

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

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
Value
float float float

The pixels per logical inch of the current environment.

Attributes

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

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
Value
DisplayOrientations DisplayOrientations DisplayOrientations

The native orientation of the display monitor.

Attributes

Remarks

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

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
Value
float float float

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

Attributes

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

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
Value
float float float

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

Attributes

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

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
Value
double double double

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

Attributes
See Also

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
Value
ResolutionScale ResolutionScale ResolutionScale

The scale factor of the immersive environment.

Attributes

ScreenHeightInRawPixels ScreenHeightInRawPixels ScreenHeightInRawPixels

Returns the current height resolution of the logical monitor.

public unsigned short ScreenHeightInRawPixels { get; }public uint ScreenHeightInRawPixels { get; }Public ReadOnly Property ScreenHeightInRawPixels As uint
Value
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.

Attributes
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

Returns the current width resolution of the logical monitor.

public unsigned short ScreenWidthInRawPixels { get; }public uint ScreenWidthInRawPixels { get; }Public ReadOnly Property ScreenWidthInRawPixels As uint
Value
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.

Attributes
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

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
Value
bool bool bool

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

Attributes

Methods

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 )
Returns

Object that manages the asynchronous retrieval of the color profile.

Attributes

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()

Gets the current physical display information.

public static DisplayInformation GetForCurrentView()public static DisplayInformation GetForCurrentView()Public Static Function GetForCurrentView() As DisplayInformation
Returns

A DisplayInformation object that contains the current physical display information.

Attributes

Remarks

This method is static.

Events

ColorProfileChanged ColorProfileChanged ColorProfileChanged

Occurs when the physical display's color profile changes.

public event TypedEventHandler ColorProfileChangedpublic event TypedEventHandler ColorProfileChangedPublic Event ColorProfileChanged
Attributes

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

Occurs when the display requires redrawing.

public static event TypedEventHandler DisplayContentsInvalidatedpublic static event TypedEventHandler DisplayContentsInvalidatedPublic Static Event DisplayContentsInvalidated
Attributes

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

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

public event TypedEventHandler DpiChangedpublic event TypedEventHandler DpiChangedPublic Event DpiChanged
Attributes

OrientationChanged OrientationChanged OrientationChanged

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

public event TypedEventHandler OrientationChangedpublic event TypedEventHandler OrientationChangedPublic Event OrientationChanged
Attributes

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

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

public event TypedEventHandler StereoEnabledChangedpublic event TypedEventHandler StereoEnabledChangedPublic Event StereoEnabledChanged
Attributes

See Also