Skip to content

[Android] DatePicker does not update MinimumDate / MaximumDate in the Popup when set in the viewmodel after first opening #33583

@MarchandCedric

Description

@MarchandCedric

Description

Hello,

When you bind a DatePicker MinimumDate and MaximumDate to a ViewModel, the first time the pop up opens, it displays correctly.
However, after the first display, if you change the MaximumDate/minimumDate in the ViewModel, the popup will open with the first values, not the updated ones.

If you need any other information don't hesitate, or if I'm doing it wrong please let me know.

Regards.

Steps to Reproduce

  1. Create a date picker and bind it.

  2. In your view model, set the MaximumDate.

  3. Open the popup, everything ok.

  4. Close the pop up.

  5. In your viewmodel, change the MaximumDate.

  6. Open the popup, it stucks to the old maximum date.

I tried with Datetime? or DateTime, same issue.

Link to public reproduction project repository

No response

Version with bug

10.0.30

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

I also tried do send a weakReferenceMessenger to my View to change the data directly from it, but same thing. Please note that in this case, if you force with :
EndDatePicker.IsEnabled = false;
await Task.Yield();
EndDatePicker.MinimumDate = null;
EndDatePicker.IsOpen = true;
await Task.Yield();
EndDatePicker.IsOpen = false;
EndDatePicker.MinimumDate = _viewModel.StartDate;
await Task.Yield();
EndDatePicker.IsEnabled = true;
When you open again the DatePicker he is updated with the good date. But it will work only one time.

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions