Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Issue rendering UIDatePicker on iPhone XS and 11plus only

TallRyanTallRyan Member ✭✭

I have a Forms project that needs a combined date & time picker, so off to the custom renderer land I went. Things seemed fine when I was testing on my iPhone 8 Plus test device, but on an iPhone XS or 11 Pro (physical devices, both on 13.3) the picker does not render correctly - all the dates are greyed out, and time is completely invisible. I played with the forms side layout as well as UIDatePicker properties, but nothing had any effect on the rendering issues on newer iOS devices. Unsurprisingly, the simulator for both those devices renders correctly. The entire sample project can be found on GitHub, esenciadev/DatePickerTest (I registered a new account to post this and so cannot post a direct link, apologies)


<StackLayout Orientation="Vertical" Margin="8,16,8,16">
    <Label Text="This is just a test"
       VerticalOptions="Start" />
    <local:MyDatePicker Date="{Binding Date}"
                        DateChangedCommand="{Binding DateChangedCommand}"

Relevant code from the renderer:

protected override void OnElementChanged(ElementChangedEventArgs<MyDatePicker> e)

    if (e.OldElement != null)
        _datePicker.ValueChanged -= DatePickerOnValueChanged;

    if (e.NewElement != null)
        if (Control == null)
            _datePicker = new UIDatePicker(new CGRect(
            _datePicker.Mode = UIDatePickerMode.DateAndTime;
            _datePicker.Date = (NSDate) Element.Date;
            _datePicker.MaximumDate = (NSDate) Element.Date.AddDays(1);
            _datePicker.MinimumDate = (NSDate) Element.Date.Subtract(TimeSpan.FromDays(5));
            _datePicker.MinuteInterval = 1;


        _datePicker.ValueChanged += DatePickerOnValueChanged;
Sign In or Register to comment.