From 32c929cb0d494a05bf68543d169c1c26159bd729 Mon Sep 17 00:00:00 2001 From: Kangho Date: Fri, 2 Mar 2018 05:13:14 +0900 Subject: [PATCH] Add Watch to TargetIdiom (#1990) --- Xamarin.Forms.Core/OnIdiom.cs | 4 ++++ Xamarin.Forms.Core/TargetIdiom.cs | 3 ++- .../Xamarin.Forms/OnIdiom`1.xml | 17 +++++++++++++++++ .../Xamarin.Forms/TargetIdiom.xml | 14 ++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/Xamarin.Forms.Core/OnIdiom.cs b/Xamarin.Forms.Core/OnIdiom.cs index 5d3226f7d..fa9a3599c 100644 --- a/Xamarin.Forms.Core/OnIdiom.cs +++ b/Xamarin.Forms.Core/OnIdiom.cs @@ -10,6 +10,8 @@ namespace Xamarin.Forms public T TV { get; set; } + public T Watch { get; set; } + public static implicit operator T(OnIdiom onIdiom) { switch (Device.Idiom) @@ -23,6 +25,8 @@ namespace Xamarin.Forms return onIdiom.Desktop; case TargetIdiom.TV: return onIdiom.TV; + case TargetIdiom.Watch: + return onIdiom.Watch; } } } diff --git a/Xamarin.Forms.Core/TargetIdiom.cs b/Xamarin.Forms.Core/TargetIdiom.cs index 645ac1299..bae97a1b1 100644 --- a/Xamarin.Forms.Core/TargetIdiom.cs +++ b/Xamarin.Forms.Core/TargetIdiom.cs @@ -6,6 +6,7 @@ namespace Xamarin.Forms Phone, Tablet, Desktop, - TV + TV, + Watch } } diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/OnIdiom`1.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/OnIdiom`1.xml index 111752680..db57ea771 100644 --- a/docs/Xamarin.Forms.Core/Xamarin.Forms/OnIdiom`1.xml +++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/OnIdiom`1.xml @@ -156,5 +156,22 @@ + + + + Property + + 2.0.0.0 + + + T + + + Gets or sets the value applied on Watch-like devices. + A T. + + + + diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/TargetIdiom.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/TargetIdiom.xml index 55a9d26a9..d5584a459 100644 --- a/docs/Xamarin.Forms.Core/Xamarin.Forms/TargetIdiom.xml +++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/TargetIdiom.xml @@ -114,5 +114,19 @@ (Unused) Indicates that Forms is running on an unsupported device. + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.TargetIdiom + + + Indicates that Forms is running on a smart watch such as Samsing Gear S serires. + +