Forum Xamarin.Forms

Add Cancel button to iOS DatePicker and TimePicker, only change the value when Done is clicked

JoeMankeJoeManke USMember ✭✭✭✭✭

Summary

On iOS, the DatePicker and TimePicker update their values every time the picker is scrolled, and there is no way to dismiss the picker without saving changes. This is not consistent with behavior on Android or UWP.

API Changes

Public API would not change. Setting Date/Time would be done in the click handler of the Done button on the input accessory toolbar instead of the ValueChanged handler of the UIDatePicker. A Cancel button would also be added to the toolbar which dismisses the Picker without changing the value.

This behavior could be managed using the UpdateMode platform specific introduced by pull request #540 to preserve current implementation.

Tagged:

Open · Last Updated

Sign In or Register to comment.