Forum Xamarin.Forms

TimePicker 24h format

BenVutiBenVuti USMember ✭✭

I want my TimePicker to be displayed in a 24h format.
I can find a "lot of answers" (the same one being repeated each time) to this online, but it doesn't work for me and I don't understand how it could even work :/

Here is the code sample that I found for iOS

[assembly: ExportRenderer(typeof(TimePicker), typeof(TimePicker24HRenderer))]
namespace Example.iOS.CustomRenderer {
    public class TimePicker24HRenderer : TimePickerRenderer {
        protected override void OnElementChanged(ElementChangedEventArgs<TimePicker> e) {
            var view = (TimePicker)Element;

            if (view != null) {
                var timePicker = (UIDatePicker)Control.InputView;

                timePicker.MinuteInterval = 15;
                timePicker.Locale = new NSLocale("fr_FR");

How is the creation of an unused variable timePicker going to do anything ?
Can anyone tell me how to make this work ?

Thanks in advance,

Best Answer


  • BenVutiBenVuti USMember ✭✭

    Oh right ! That's silly, I didn't realize that it was a reference. My bad...
    Aaaand my question really was completely pointless, because after a clean/build it works as expected.
    Sorry for wasting your time ^^'

Sign In or Register to comment.