Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial date binding does not display #8

Open
Roller007 opened this issue Mar 30, 2018 · 2 comments
Open

initial date binding does not display #8

Roller007 opened this issue Mar 30, 2018 · 2 comments

Comments

@Roller007
Copy link

Roller007 commented Mar 30, 2018

Xamarin Forms: 2.5.0.28

If there is a date when initially coming to the page the control will not show the date even though a date is bound to the control.

I can choose a new date and save, or even save with the initially bound date, that works fine but it will not show the initially bound date.

@XamDevToo
Copy link

XamDevToo commented May 16, 2019

Same here Xamarin Forms: 3.4.0.1029999, difficult to fix,

For example in Android NulleableDatePickerRenderer class, OnElementPropertyChanged method (M#1) never receive a PropertyName value "NulleableDate" and OnElementChange method (M#2 who set the bound value) is called before M#1 making impossible to set the bound value IF were received in M#1.

The binding property used is NulleableDate, the DateTimeToStringConverter (IValueConverter) Convert method (M#3) receive null as binding value for every NullableDatePicker control of the xaml page and is called before M#1 and M#2 methods, this is the control declaration:

<customControls:NullableDatePicker
MaximumDate="{x:Static system:DateTime.Today}"
NullableDate="{Binding PersonaModel.per_fecha_nacimiento, Converter={StaticResource DateTimeToStringConverter}}"
Format="{StaticResource FormatoFecha}"/>

Very nice solution but useless without binding, any suggestions to fix this problem?

@bsmarshall
Copy link

@XamDevToo I had the same issue and after quite a bit of debugging I found that my bound field was a DateTimeOffset. I corrected my converter to properly pass in a DateTime and it worked. In your example your converter is converting between DateTime and String. Perhaps you need to review your converter too.

No doubt you've moved on from this but this may assist someone else in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants