Xamarin.Forms Guides | Samples

Xamarin.Forms.Device Class

A utility class to interact with the current Device/Platform.

See Also: Device

Syntax

public static class Device

Remarks

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.0.0.0, 1.1.0.0, 1.2.0.0, 1.3.0.0, 1.4.0.0, 1.5.0.0, 2.0.0.0

The members of Xamarin.Forms.Device are listed below.

See Also: Object

Public Fields

const
AndroidString. The string "Android", representing the Android operating system.
const
iOSString. The string "iOS", representing the iOS operating system.
const
WindowsString.
const
WinPhoneString. The string "WinPhone", representing the Windows Mobile operating system.

Public Properties

[read-only]
static
IdiomTargetIdiom. Gets the kind of device that Xamarin.Forms is currently working on.
[read-only]
static
OSTargetPlatform. Gets the TargetPlatform indicating the OS Xamarin.Forms is working on.
[read-only]
static
RuntimePlatformString. Gets the kind of device that Xamarin.Forms is currently working on.

Public Methods

static
BeginInvokeOnMainThread(Action)
Invokes an Action on the device main (UI) thread.
static
GetNamedSize(NamedSize, Type) : Double
Returns a double that represents the named size for the font that is used on the element on the native platform.
static
GetNamedSize(NamedSize, Element) : Double
Returns a double that represents a font size that corresponds to size on targetElement.
static
OnPlatform(Action, Action, Action, Action)
Executes different Actions depending on the TargetOS that Xamarin.Forms is working on.
static
OnPlatform<T>(T, T, T) : T
Returns different values depending on the TargetOS Xamarin.Forms is working on.
static
OpenUri(Uri)
Request the device to open the Uri.
static
StartTimer(TimeSpan, Func<bool>)
Starts a recurring timer using the device clock capabilities.