我正在尝试为启用Entry
的 iOS 平台自定义一个字段。Visual=Material
我尝试过,CustomRenderer
但由于是 iOS 平台,我不知道如何达到,例如,在不修改控件的整个文本颜色的情况下修改材质底部边框颜色。
[assembly: ExportRenderer(typeof(Entry), typeof(CustomMaterialEntryRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
public class CustomMaterialEntryRenderer : MaterialEntryRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if (Control == null || e.NewElement == null) return;
Layer.BorderColor = Color.FromHex("#cedee7").ToCGColor();
}
}
为了以防万一,我希望底线为红色,文本为黑色。
提前致谢!