Forum Xamarin.Forms

DatePicker Formats on Picker Wheel

StephenJohnGrayStephenJohnGray GBUniversity ✭✭

With Xamarin Forms it's possible to set the date format in a DataPicker in Xaml or in code as in the example below:

datepickerInstance.Format = "MMM yyyy";


datepickerInstance.Format = "yyyy";

The formt is fine for the value in the TextEntry but the Picker Wheel itself still shows the full date i.e. January 14 2015. Is this easy to change using the 'out of the box date picker' or do I have to write a Custom Renderer? So for example if I set the format to 'yyyy' I would just see a list of years in the Picker Wheel.

Thanks for any help you can give.



  • Beachside_JasonBeachside_Jason USMember ✭✭

    That would be nice...don't know how to do it but i've got the same problem.

  • TylerVanderhoefTylerVanderhoef USUniversity

    That would be nice. I recently needed something like this, so I just rolled my own little control. Check out this Gist: Xaml usage would be similar to this: <vms:YearMonthPicker SelectedItem="{Binding Data}" PickerType="{Binding Type}"/> where the Data property is an integer, and the Type is a PickerType. It worked for our purposes, but unfortunately not a 100% replacement for whole dates. Just for years and months.

Sign In or Register to comment.