Skip to content

Latest commit

 

History

History
59 lines (45 loc) · 1.83 KB

displaypropertieseventhandler.md

File metadata and controls

59 lines (45 loc) · 1.83 KB
-api-id -api-type
T:Windows.Graphics.Display.DisplayPropertiesEventHandler
winrt delegate

Windows.Graphics.Display.DisplayPropertiesEventHandler

-description

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.

-parameters

-param sender

The object that raised the event.

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

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

-see-also