summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core/OnIdiom.cs
blob: 24ada8656cdaf2db014deb9f837118ad90656a1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
´╗┐namespace Xamarin.Forms
{
	public class OnIdiom<T>
	{
		public T Phone { get; set; }

		public T Tablet { get; set; }
		
		public T Desktop { 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;
				case TargetIdiom.Desktop:
					return onIdiom.Desktop;
			}
		}
	}
}