DisplayInformation DisplayInformation DisplayInformation DisplayInformation Class

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

Syntax

Declaration

public sealed class DisplayInformationpublic sealed class DisplayInformationPublic NotInheritable Class DisplayInformationpublic sealed class DisplayInformation

Remarks

To handle DisplayInformation events, use an event handler for the specific event. For example, for 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 summary

Gets and sets the preferred orientation of the app.

Gets the current orientation of a rectangular monitor.

Diagonal size of the display in inches.

Gets the pixels per logical inch of the current environment.

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.

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

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

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

Gets the scale factor of the immersive environment.

Returns the current height resolution of the logical monitor.

Returns the current width resolution of the logical monitor.

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

Methods summary

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

Gets the current physical display information.

Events summary

Occurs when the physical display's color profile changes.

Occurs when the display requires redrawing.

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

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

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

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 DisplayOrientationspublic static DisplayOrientations AutoRotationPreferences { get; set; }

    Property Value

    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 DisplayOrientationspublic DisplayOrientations CurrentOrientation { get; }

    Property Value

    Remarks

    The value of the 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 Value property.

  • DiagonalSizeInInches
    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>public IReference<double> DiagonalSizeInInches { get; }

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

  • 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 floatpublic float LogicalDpi { get; }

    Property 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 DisplayOrientationspublic DisplayOrientations NativeOrientation { get; }

    Property Value

    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 floatpublic float RawDpiX { get; }

    Property 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 floatpublic float RawDpiY { get; }

    Property 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 doublepublic double RawPixelsPerViewPixel { get; }

    Property Value

    • double
      double
      double
      double

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

  • 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 ResolutionScalepublic ResolutionScale ResolutionScale { get; }

    Property Value

  • ScreenHeightInRawPixels
    ScreenHeightInRawPixels
    ScreenHeightInRawPixels
    ScreenHeightInRawPixels

    Returns the current height resolution of the logical monitor.

    public uint ScreenHeightInRawPixels { get; }public uint ScreenHeightInRawPixels { get; }Public ReadOnly Property ScreenHeightInRawPixels As uintpublic uint ScreenHeightInRawPixels { get; }

    Property Value

    • uint
      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.

  • ScreenWidthInRawPixels
    ScreenWidthInRawPixels
    ScreenWidthInRawPixels
    ScreenWidthInRawPixels

    Returns the current width resolution of the logical monitor.

    public uint ScreenWidthInRawPixels { get; }public uint ScreenWidthInRawPixels { get; }Public ReadOnly Property ScreenWidthInRawPixels As uintpublic uint ScreenWidthInRawPixels { get; }

    Property Value

    • uint
      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.

  • StereoEnabled
    StereoEnabled
    StereoEnabled
    StereoEnabled

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

    public bool StereoEnabled { get; }public bool StereoEnabled { get; }Public ReadOnly Property StereoEnabled As boolpublic bool StereoEnabled { get; }

    Property Value

    • bool
      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 )public IAsyncOperation<IRandomAccessStream> GetColorProfileAsync()

    Returns

    • Object that manages the asynchronous retrieval of the color profile.

    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 DisplayInformationpublic static DisplayInformation GetForCurrentView()

    Returns

    Remarks

    This method is static.

Events

  • ColorProfileChanged
    ColorProfileChanged
    ColorProfileChanged
    ColorProfileChanged

    Occurs when the physical display's color profile changes.

    public event TypedEventHandler ColorProfileChangedpublic event TypedEventHandler ColorProfileChangedPublic Event ColorProfileChangedpublic event TypedEventHandler ColorProfileChanged

    Remarks

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

  • DisplayContentsInvalidated
    DisplayContentsInvalidated
    DisplayContentsInvalidated
    DisplayContentsInvalidated

    Occurs when the display requires redrawing.

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

    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 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 DpiChangedpublic event TypedEventHandler DpiChangedPublic Event DpiChangedpublic event TypedEventHandler DpiChanged
  • 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 OrientationChangedpublic event TypedEventHandler OrientationChangedPublic Event OrientationChangedpublic event TypedEventHandler OrientationChanged

    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 Value property.

  • StereoEnabledChanged
    StereoEnabledChanged
    StereoEnabledChanged
    StereoEnabledChanged

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

    public event TypedEventHandler StereoEnabledChangedpublic event TypedEventHandler StereoEnabledChangedPublic Event StereoEnabledChangedpublic event TypedEventHandler StereoEnabledChanged

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute

Details

Assembly

Windows.Graphics.Display.dll