Device Class

Definition

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

public static class Device
type Device = class
Inheritance
Device

Fields

Android

The string "Android", representing the Android operating system.

GTK

The string "GTK", representing the Linux operating system.

info

For internal use by the Xamarin.Forms platform.

iOS

The string "iOS", representing the iOS operating system.

macOS

The string "macOS", representing the macOS operating system.

Tizen

The string "Tizen", representing the Tizen operating system.

UWP

The string "UWP", representing the UWP operating system.

WPF

The string "WPF", representing the Windows Presentation Foundation framework.

Properties

Flags

Gets a list of custom flags that were set on the device before Xamarin.Forms was initialized.

FlowDirection

Gets the flow direction on the device.

Idiom

Gets the kind of device that Xamarin.Forms is currently working on.

Info

For internal use by the Xamarin.Forms platform.

IsInvokeRequired

For internal use by the Xamarin.Forms platform.

OS

Gets the TargetPlatform indicating the OS Xamarin.Forms is working on.

PlatformServices

For internal use by the Xamarin.Forms platform.

RuntimePlatform

Gets the kind of device that Xamarin.Forms is currently working on.

Methods

BeginInvokeOnMainThread(Action)

Invokes an Action on the device main (UI) thread.

GetAssemblies()

For internal use by the Xamarin.Forms platform.

GetNamedSize(NamedSize, Element)

Returns a double that represents a font size that corresponds to size on targetElement.

GetNamedSize(NamedSize, Type)

Returns a double that represents the named size for the font that is used on the element on the native platform.

GetNamedSize(NamedSize, Type, Boolean)

For internal use by the Xamarin.Forms platform.

OnPlatform(Action, Action, Action, Action)

Executes different Actions depending on the TargetPlatform that Xamarin.Forms is working on.

OnPlatform<T>(T, T, T)

Returns different values depending on the TargetPlatform Xamarin.Forms is working on.

OpenUri(Uri)

Request the device to open the Uri.

SetFlags(IReadOnlyList<String>)

Sets a list of custom flags on the device.

SetFlowDirection(FlowDirection)

Sets the flow direction on the device.

SetIdiom(TargetIdiom)

For internal use by the Xamarin.Forms platform.

SetTargetIdiom(TargetIdiom)

For internal use by the Xamarin.Forms platform.

StartTimer(TimeSpan, Func<Boolean>)

Starts a recurring timer on the UI thread using the device clock capabilities.

Applies to