Back to Home
Handling orientation changes in Windows 8
September 26, 2012 • 1 minute read

DisplayProperties class provides various properties that are related to the physical display. For most of these properties, the class provides events to allow clients to monitor for changes in the properties.
Respond to the static OrientationChanged event. Determine the orientation from the CurrentOrientation property.
partial class MainPage
{
public MainPage()
{
InitializeComponent();
DisplayProperties.OrientationChanged += OnOrientationChanged;
}
void OnOrientationChanged(object sender)
{
var orientation = DisplayProperties.CurrentOrientation; // ...
}
}