/
MaterialPickerRenderer.cs
33 lines (28 loc) · 1.2 KB
/
MaterialPickerRenderer.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
using System.ComponentModel;
using UIKit;
using Xamarin.Forms.Platform.iOS;
namespace Xamarin.Forms.Material.iOS
{
public class MaterialPickerRenderer : PickerRendererBase<MaterialTextField>, IMaterialEntryRenderer
{
protected override MaterialTextField CreateNativeControl() => new ReadOnlyMaterialTextField(this, Element);
protected override void SetBackgroundColor(Color color) => ApplyTheme();
protected internal override void UpdateFont()
{
base.UpdateFont();
Control?.ApplyTypographyScheme(Element);
}
protected internal override void UpdateTextColor() => Control?.UpdateTextColor(this);
protected virtual void ApplyTheme() => Control?.ApplyTheme(this);
protected internal override void UpdatePlaceholder() => Control?.UpdatePlaceholder(this);
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
{
base.OnElementChanged(e);
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;
}
}