Read the previous part of the series here,
- Quick Start Tutorial: Creating Universal Apps Via Xamarin - Part One
- Quick Start Tutorial: Creating Universal Apps Via Xamarin - Part Two
- Quick Start Tutorial: Creating Universal Apps via Xamarin: Label and Button - Part Three
This article explains about the device class of Xamarin SDK.
Device class
This class is used to identify the platform (Windows Phone, UWP, iOS, Android) and the device (Mobile, Tablet, Desktop) and it supports other functionalities.

Device.OS- This option is used to identify platform and is TargetPlatform enumeration type,
- TargetPlatform. Android
- TargetPlatform.WinPhone
- TargetPlatform. Windows
- TargetPlatform.iOS
- TargetPlatform.Other
Each type is clearly understandable. What is the difference between WinPhone and Windows?
Windows- It is used to identity the Application running in the Universal Windows Platform (Windows 8.1).
WinPhone- It is used to identity the Windows 8 device.
OS is running in the different devices like mobile, tablet, and desktop. Device.Idiom class is used to identity the device.
Device.Idiom- This option is used to identity the device,
- TargetIdiom.Desktop
- TargetIdiom.Phone
- TargetIdiom.Tablet
- TargetIdiom.Unsupported
TargetIdiom.Desktop- This is used to identify the Application running in the desktop. Windows 10 currently is a preview version.
Example Set the different font sizes in different platforms,
- var targetPlatform = Device.OS.ToString();
- var targetdevice = Device.Idiom.ToString();
- switch (Device.OS)
- {
- case TargetPlatform.Other:
- break;
- case TargetPlatform.iOS:
- platformVal = 20;
- break;
- case TargetPlatform.Android:
- platformVal = 30;
- break;
- case TargetPlatform.WinPhone:
- platformVal = 35;
- break;
- case TargetPlatform.Windows:
- platformVal = 35;
- break;
- }
- d If different size set the Phone, Tablet and Desktop
- switch (Device.Idiom)
- {
- case TargetIdiom.Unsupported:
- break;
- case TargetIdiom.Phone:
- break;
- case TargetIdiom.Tablet:
- platformVal = 50;
- break;
- case TargetIdiom.Desktop:
- platformVal = 60;
- break;
- }












kalu singh raoPosted Jul 18, 2016, 1:37 AM
Nice...
Santhakumar MunuswamyPosted Jun 25, 2016, 3:06 AM
Nice share
Kuppurasu NagarajPosted Jun 14, 2016, 1:14 PM
Nice Sharing..
Vignesh ManiPosted Jun 14, 2016, 12:10 PM
Nice
RajaPosted Jun 14, 2016, 12:05 AM
Nice Share...