Easy Datepicker Selection Date

Actually in Android the DatePicker is showed acording to phone model, Android version and others. But in the next form is very complicated, is not a comfortable for the user to do many clics to get a desired date.

For example today is 22/01/2020 but I want to change a date like a 26/10/1991. How to get a solution to change the date easily?


  • LeonLuLeonLu Member, Xamarin Team Xamurai

    You can change the Year easliy(click the year), please see the following GIF.

    If you still do not want to use this style, you can change another style for the datePicker.Open your styles.xml, change the AppCompatDialogStyle like following screenshot.

    Here is running GIF.

    If you want to change a custom DataPicker(Xamarin.Forms.DatePicker is renderered into an EditText control), you could use Custom renderer to the achieve that.

    The pop up DatePickerDialog is unfortunately not exposed to user. You can see that from Source Codes of DatePickerRenderer.

    But you can override the click event for EditText, push up your own DialogFragment like following code.

     [assembly: ExportRenderer(typeof(Xamarin.Forms.DatePicker), typeof(MyDatePickerRenderer))]
     namespace DataPickerDemo.Droid
       class MyDatePickerRenderer:DatePickerRenderer
        Context context;
        public MyDatePickerRenderer(Context context) : base(context)
            this.context = context;
        protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.DatePicker> e)
           // Control.Click += Control_Click;
        private void Control_Click(object sender, EventArgs e)
            // throw new NotImplementedException();
            //DialogFragment dialogfragment = new DatePickerDialogTheme5();
            //dialogfragment.show(getFragmentManager(), "Theme 5");
Sign In or Register to comment.