-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Bug][DatePicker][XF5] DatePicker empty format now invalid #13577
Comments
Hi, @McFlemchSoda - thanks for submitting this issue! I'm having some trouble reproducing this - how were you setting the format in 4.8? Are you doing |
Hi @rachelkang! |
So, I've done some more testing and at least found a way to make my delete button work again. For some reason I did But there still is an issue with setting the format. When loading the page the first time I tried setting |
Since setting the Format doesn't work properly anymore I did the following workaround for my specific case.
|
Any update on this? |
Hey @McFlemchSoda (Netherlands represent!), a PR for this is open now (#14695), would you be able to grab the NuGet as described here and let us know if this fixes this issue? That will greatly speed up the review process. Besides verifying if this particular issue is fixed also be sure to check other scenarios in the same area to make sure that this fix doesn't accidentally has side-effects 🙂 Thanks! |
Since I updated to Xamarin.Forms 5.0 the DatePicker does not accept Format = " " anymore. I use this to simulate a nullable datepicker. When the binded date is null it just defaults to the current date in a M/dd/yy format and does not work with an empty format anymore. Since Xamarin does not yet support a nullable datepicker, we do rely on the manipulation of Format in a custom renderer to re-create this effect.
I'd like to know if this can be fixed/reverted or if we shift focus to finish the Nullable DatePicker that's been waiting to be finished. #10175
Reproduction steps
Expected Behavior
When format = " " we expect the date label to be empty as in previous versions.
See section screen recordings for examples.
Actual Behavior
Changing format = " " gets ignored and defaults to M/dd/yy of even crashes because the DateFormat is not recognised.
Basic Information
Environment
Visual Studio Enterprise 2019 for Mac
Sample solutions
DatePicker_XF4.8.0.1821.zip
DatePicker_XF5.0.0.1931.zip
Screen Recordings
"Wissen" means Delete in Dutch. When clicking that button the date needs to disappear because we set Format = " ". Which happens in XF4.8 but goes to default in XF5.
XF 4.8 Nullable DatePicker
https://user-images.githubusercontent.com/8875682/106153509-eaeb6100-617e-11eb-9891-392d4ffcf35d.mov
XF5 DatePicker
https://user-images.githubusercontent.com/8875682/106153748-2ab24880-617f-11eb-9fe3-49b4c9f24e43.mov
Workaround
Since setting the DatePicker Format is not working properly I manipulate
Control.Text
. in my custom renderer in theOnElementChanged
I check if the date from my custom NullableDatePicker is null and then setControl.Text = string.Empty
EDIT: Added a sample solution with our custom renderer + Reproduction steps
EDIT2: Found a workaround for my specific case.
The text was updated successfully, but these errors were encountered: