Discovering the Current Orientation

Windows can tell you which of the four possible orientations your window’s screen is in:

Landscape (horizontal)

Landscape-flipped (horizontal but upside down)

Portrait (vertical, with the “bottom” of the screen on the left)

Portrait-flipped (vertical, with the “bottom” of the screen on the right)

It’s hard to imagine a valid reason for adjusting a user interface based on flipped versus nonflipped. Nevertheless, if you care about distinguishing between any orientations, you can discover the current orientation via the static Windows.Graphics.Display.DisplayProperties.CurrentOrientation property. This property is a DisplayOrientations enumeration with the four possible values plus None. The reason for ...

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.