using System; using Xamarin.Forms.CustomAttributes; namespace Xamarin.Forms.Controls { internal class TimePickerCoreGalleryPage : CoreGalleryPage { protected override bool SupportsTapGestureRecognizer => false; protected override void Build(StackLayout stackLayout) { base.Build(stackLayout); var formatContainer = new ViewContainer(Test.TimePicker.Format, new TimePicker { Format = "HH-mm-ss" }); var timeContainer = new ViewContainer(Test.TimePicker.Time, new TimePicker { Time = new TimeSpan(14, 45, 50) }); var textColorContainer = new ViewContainer(Test.TimePicker.TextColor, new TimePicker { Time = new TimeSpan(14, 45, 50), TextColor = Color.Lime }); var fontAttributesContainer = new ViewContainer(Test.TimePicker.FontAttributes, new TimePicker { FontAttributes = FontAttributes.Bold }); var fontFamilyContainer = new ViewContainer(Test.TimePicker.FontFamily, new TimePicker()); // Set font family based on available fonts per platform switch(Device.RuntimePlatform) { case Device.Android: fontFamilyContainer.View.FontFamily = "sans-serif-thin"; break; case Device.iOS: fontFamilyContainer.View.FontFamily = "Courier"; break; default: fontFamilyContainer.View.FontFamily = "Garamond"; break; } var fontSizeContainer = new ViewContainer(Test.TimePicker.FontSize, new TimePicker { FontSize = 24 }); Add(formatContainer); Add(timeContainer); Add(textColorContainer); Add(fontAttributesContainer); Add(fontFamilyContainer); Add(fontSizeContainer); } } }