Share via


DisplayPropertiesEventHandler Delegate

Definition

Note

The DisplayProperties type and related event handlers may be altered or unavailable for releases after Windows 8.1. Instead, use DisplayInformation.

Represents a method that handles display property events.

public delegate void DisplayPropertiesEventHandler(Platform::Object ^ sender);
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Deprecated("DisplayProperties may be altered or unavailable for releases after Windows Phone 8.1. Instead, use DisplayInformation.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.Guid(3688729345, 61857, 18129, 158, 227, 84, 59, 204, 153, 89, 128)]
class DisplayPropertiesEventHandler : MulticastDelegate
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(3688729345, 61857, 18129, 158, 227, 84, 59, 204, 153, 89, 128)]
/// [Windows.Foundation.Metadata.Deprecated("DisplayProperties may be altered or unavailable for releases after Windows Phone 8.1. Instead, use DisplayInformation.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
class DisplayPropertiesEventHandler : MulticastDelegate
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Deprecated("DisplayProperties may be altered or unavailable for releases after Windows Phone 8.1. Instead, use DisplayInformation.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Guid(3688729345, 61857, 18129, 158, 227, 84, 59, 204, 153, 89, 128)]
public delegate void DisplayPropertiesEventHandler(object sender);
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(3688729345, 61857, 18129, 158, 227, 84, 59, 204, 153, 89, 128)]
[Windows.Foundation.Metadata.Deprecated("DisplayProperties may be altered or unavailable for releases after Windows Phone 8.1. Instead, use DisplayInformation.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
public delegate void DisplayPropertiesEventHandler(object sender);
var displayPropertiesEventHandlerHandler = function(sender){
/* Your code */
}
Public Delegate Sub DisplayPropertiesEventHandler(sender As Object)

Parameters

sender
Object

Platform::Object

IInspectable

The object that raised the event.

Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

#include <winrt/Windows.Graphics.Display.h>
using namespace winrt;
using namespace Windows::Graphics::Display;
...
void GameRenderer::Initialize()
{
    DisplayProperties::StereoEnabledChanged({ this, &GameRenderer::OnStereoEnableChanged });
}

void GameRenderer::OnStereoEnableChanged(winrt::Windows::Foundation::IInspectable const& sender)
{
    UpdateForStereoChange();
}
void GameRenderer::Initialize()
{
    DisplayProperties::StereoEnabledChanged += 
        ref new DisplayPropertiesEventHandler(this, &GameRenderer::OnStereoEnableChanged);
}

void GameRenderer::OnStereoEnableChanged(_In_ Platform::Object^ sender)
{
    UpdateForStereoChange();
}

Remarks

We recommend that applications use a single delegate to handle most display events because in most cases the change to each display property requires that the application redraw itself. Also, many property changes result from a single mode change that affects the entire operating system.

The Direct3D 11.1 Simple Stereo 3D Sample shows how to handle system stereo changes.

Applies to