summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core/OnIdiom.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Core/OnIdiom.cs')
-rw-r--r--Xamarin.Forms.Core/OnIdiom.cs21
1 files changed, 21 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core/OnIdiom.cs b/Xamarin.Forms.Core/OnIdiom.cs
new file mode 100644
index 00000000..9376d5b9
--- /dev/null
+++ b/Xamarin.Forms.Core/OnIdiom.cs
@@ -0,0 +1,21 @@
+namespace Xamarin.Forms
+{
+ public class OnIdiom<T>
+ {
+ public T Phone { get; set; }
+
+ public T Tablet { get; set; }
+
+ public static implicit operator T(OnIdiom<T> onIdiom)
+ {
+ switch (Device.Idiom)
+ {
+ default:
+ case TargetIdiom.Phone:
+ return onIdiom.Phone;
+ case TargetIdiom.Tablet:
+ return onIdiom.Tablet;
+ }
+ }
+ }
+} \ No newline at end of file