Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

wcoder/Xamarin.Plugin.DeviceOrientation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Device Orientation Plugin for Xamarin and Windows

Simple cross platform plugin to get screen orientation of mobile device.

Setup

...

Platform Support

Platform Supported Version
Xamarin.iOS Yes iOS 2.0+
Xamarin.iOS Unified Yes
Xamarin.Android Yes API 3+
Windows Phone Silverlight +/- 8.0+
Windows Phone RT Yes 8.1+
Windows Store RT Yes 8.1+
Windows 10 UWP Yes 10+
Xamarin.Mac No

+/- [not tested on device]

API Usage

Call CrossDeviceOrientation.Current from any project or PCL to gain access to APIs.

/// <summary>
/// Gets current device orientation
/// </summary>
DeviceOrientations CurrentOrientation { get; }

When device orientation is changed you can register for an event to fire:

/// <summary>
/// Event handler when orientation changes
/// </summary>
event OrientationChangedEventHandler OrientationChanged;

You will get a ConnectivityChangeEventArgs with the orientation type:

public class OrientationChangedEventArgs : EventArgs
{
	public DeviceOrientations Orientation { get; set; }
}

public delegate void OrientationChangedEventHandler(object sender, OrientationChangedEventArgs e);

The DeviceOrientations enumeration has these members.

Member Value Description
Undefined 0 No display orientation is specified.
Landscape 1 Specifies that the monitor is oriented in landscape mode where the width of the display viewing area is greater than the height.
Portrait 2 Specifies that the monitor rotated 90 degrees in the clockwise direction to orient the display in portrait mode where the height of the display viewing area is greater than the width.
LandscapeFlipped 4 Specifies that the monitor rotated another 90 degrees in the clockwise direction (to equal 180 degrees) to orient the display in landscape mode where the width of the display viewing area is greater than the height. This landscape mode is flipped 180 degrees from the Landscape mode.
PortraitFlipped 8 Specifies that the monitor rotated another 90 degrees in the clockwise direction (to equal 270 degrees) to orient the display in portrait mode where the height of the display viewing area is greater than the width. This portrait mode is flipped 180 degrees from the Portrait mode.

Additional information

Contributors


© 2016 MIT License

Morty Proxy This is a proxified and sanitized view of the page, visit original site.