I have a TimePicker and changed the Format to "HH:mm" to disable the AM-PM system. However, the picker still shows AM and PM instead of numbers from 00:00 to 23:59.
<TimePicker Time="13:00" Format="HH:mm"/>
答案 0 :(得分:0)
格式仅表示用户如何看到他选择的值。 如果要更改控件本身的外观,则必须为TimePicker实现自定义渲染器。我相信这个link可以帮助您创建自定义渲染器。
答案 1 :(得分:0)
您可以使用自定义渲染器实现此效果:
[assembly: ExportRenderer(typeof(TimePicker), typeof(MyTimePickerRenderer))]
namespace App18.iOS
{
class MyTimePickerRenderer:TimePickerRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<TimePicker> e)
{
base.OnElementChanged(e);
if (Control != null)
{
UIDatePicker picker = Control.InputView as UIDatePicker;
picker.Mode = UIDatePickerMode.Time;
NSLocale locale = new NSLocale("en_GB");
picker.Locale = locale;
}
}
}
}