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.
static
infoDeviceInfo. For internal use by the Xamarin.Forms platform.
const
iOSString. The string "iOS", representing the iOS operating system.
const
macOSString. The string "macOS", representing the macOS operating system.
const
UWPString. The string "Windows", representing the Windows operating system.
const
WinPhoneString. The string "WinPhone", representing the Windows Mobile operating system.
const
WinRTString. The string "WinRT", representing the Windows Runtime platform.

Public Properties

[read-only]
static
FlagsIReadOnlyList<string>.
[read-only]
static
IdiomTargetIdiom. Gets the kind of device that Xamarin.Forms is currently working on.
static
InfoDeviceInfo. For internal use by the Xamarin.Forms platform.
[read-only]
static
IsInvokeRequiredBoolean. For internal use by the Xamarin.Forms platform.
[read-only]
static
OSTargetPlatform. Gets the TargetPlatform indicating the OS Xamarin.Forms is working on.
static
PlatformServicesIPlatformServices. For internal use by the Xamarin.Forms platform.
[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
GetAssemblies() : Assembly[]
For internal use by the Xamarin.Forms platform.
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
GetNamedSize(NamedSize, Type, Boolean) : Double
For internal use by the Xamarin.Forms platform.
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
SetFlags(IReadOnlyList<string>)
static
SetIdiom(TargetIdiom)
For internal use by the Xamarin.Forms platform.
static
SetTargetIdiom(TargetIdiom)
For internal use by the Xamarin.Forms platform.
static
StartTimer(TimeSpan, Func<bool>)
Starts a recurring timer using the device clock capabilities.