Xamarin.forms: [Enhancement] Add a Clear button to DatePicker and TimePicker

Created on 19 Sep 2018  Â·  9Comments  Â·  Source: xamarin/Xamarin.Forms

Rationale

See https://xamarin.uservoice.com/forums/144858/suggestions/16997776

Implementation

TBD

API

TBD

F100 datepicker timepicker inactive high impact proposal-open enhancement âž•

Most helpful comment

Copied comment from https://github.com/xamarin/Xamarin.Forms/pull/6947#issuecomment-513905929

In my custom nullable pickers, we have have 3 buttons: Clear (set to null), Cancel (close the dialog without changing the BindableProperty's value) and OK/Done (set the BindableProperty value to the current dialog value).

Screenshot_1563820576

ios_nullable_datepicker

All 9 comments

As a part of this you will also need to support a null value, DateTime?, correct? Even better would be to just support a string and a blank string is no value. We are using Csla and the SmartDate handles this brilliantly, I won't have to write yet another value converter. Thanks!

@davidortinau I don't understand, why did you set the issue on UserVoice to COMPLETED.
It's misleading, it's not completed, why not set the issue to PLANNED?
The UserVoice on that portal, xamarin.uservoice.com is completely broken. It looks like "planned" was overwritten with "completed" status. If I select "planned" it shows "completed" features. Sigh...

@opcodewriter sorry if I got your hopes up.

I marked them completed because there is a transition happening with our use of UserVoice and the only way to grant you back your votes was to mark it completed. I tried to make the actual status clear in the comment I added. We won't be tracking those items moving forward on UserVoice.

related to #3728

I am looking into #3728, when that is implemented; is this really added value?
What would a button look like on the different platforms? For iOS it can be added to the toolbar, but other platforms might need a different mechanism since they don't have the toolbar concept. I think if we add a button, users will want to be able to style it, etc.

I would propose to just implement the nullable date (or time for that matter) and let users implement their own clearing functionality/buttons/controls.

Thoughts?

Either that are create an event when the cancel button is hit. Should come that way by default.

I wanted initially to add a comment to #6947 but I want to keep discussion separated.

I think it's confusing to have a Clear button on the picker dialog. The picker dialog itself always shows a date, there's no way not have it show a date selected, like how for example selection works in ListView (SelectedItem can be null).

So I think a Clear button would make more sense on the picker text field and it makes sense to work with the new SelectedDate property on the DatePicker I'm trying to add in #6947:

image

If we agree it makes sense to have a Clear button this way, I can work on a separate PR to have the DatePicker show a Clear button to set the new SelectedDate property to null. It would require however first getting merged #6947 and #5277 (which btw, I don't know why it was postponed again to vNext+1).

Eager to hear thoughts on having the Clear button on the text field and not on the picker.

Copied comment from https://github.com/xamarin/Xamarin.Forms/pull/6947#issuecomment-513905929

In my custom nullable pickers, we have have 3 buttons: Clear (set to null), Cancel (close the dialog without changing the BindableProperty's value) and OK/Done (set the BindableProperty value to the current dialog value).

Screenshot_1563820576

ios_nullable_datepicker

One concern we had when doing the Nullable Date Picker for ourselves was the clear button on the Text Field.

If we put it on the text field, what about when we wanted to do the nice thing and stick a Calendar icon over there to appear like the UWP Date Picker? That was an option a few of our guys requested, and I thought it looked strange when we had both an X and a Calendar.

Was this page helpful?
0 / 5 - 0 ratings