1

Currently I'm trying to create a timepicker which would provide the 24 hours of the day in different sets of intervals.

I was able to override the default "clock" style of the xamarin forms timepicker (https://developer.xamarin.com/guides/android/user_interface/controls/pickers/time-picker/) to be in spinner mode always and also I followed this post (https://forums.xamarin.com/discussion/21119/xamarin-forms-timepicker-with-15-minutes-intervals) to have 15 minutes of interval on my timepicker which is working perfectly:

numberPicker.MinValue = 0; numberPicker.MaxValue = 3; numberPicker.SetDisplayedValues(new[] { "00", "15", "30", "45" });

So I assumed that

numberPicker.MinValue = 0; numberPicker.MaxValue = 1; numberPicker.SetDisplayedValues(new[] { "00", "30" });

would do the trick, but it just displays those two values and doesn't let me "infinitely scroll" through them and pass to the next or previous hour accordingly like it does when we have more than 4 values. I also tried

numberPicker.MinValue = 0; numberPicker.MaxValue = 3; numberPicker.SetDisplayedValues(new[] { "00", "30", "00", "30" });

but then each hour has 2 duplicated values like this:

11:00

11:30

11:00

11:30

12:00

Can someone help me point out what am I doing wrong or even if it's possible to do something like this without breaking the rules of conformity of a timepicker.

Thanks in advance. Ricardo

RMSPereira
  • 155
  • 1
  • 13

0 Answers0