/
MaterialTimePickerRenderer.cs
35 lines (29 loc) · 1.22 KB
/
MaterialTimePickerRenderer.cs
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
26
27
28
29
30
31
32
33
34
35
using System.ComponentModel;
using UIKit;
using Xamarin.Forms.Platform.iOS;
namespace Xamarin.Forms.Material.iOS
{
public class MaterialTimePickerRenderer : TimePickerRendererBase<MaterialTextField>, IMaterialEntryRenderer
{
internal void UpdatePlaceholder() => Control?.UpdatePlaceholder(this);
protected internal override void UpdateFont()
{
base.UpdateFont();
Control?.ApplyTypographyScheme(Element);
}
protected override MaterialTextField CreateNativeControl() => new NoCaretMaterialTextField(this, Element);
protected override void SetBackgroundColor(Color color) => ApplyTheme();
protected internal override void UpdateTextColor() => Control?.UpdateTextColor(this);
protected virtual void ApplyTheme() => Control?.ApplyTheme(this);
protected override void OnElementChanged(ElementChangedEventArgs<TimePicker> e)
{
base.OnElementChanged(e);
if(e.NewElement != null)
UpdatePlaceholder();
}
string IMaterialEntryRenderer.Placeholder => string.Empty;
Color IMaterialEntryRenderer.PlaceholderColor => Color.Default;
Color IMaterialEntryRenderer.TextColor => Element?.TextColor ?? Color.Default;
Color IMaterialEntryRenderer.BackgroundColor => Element?.BackgroundColor ?? Color.Default;
}
}