Open Eves101 opened 12 months ago
Verified this on Visual Studio Enterprise 17.9.0 Preview 1(8.0.3). Repro on Android 14.0-API34 and MacCatalyst, not repro on Windows 11 and iOS 17.0 with below Project: DatepickerFocusIssue.zip
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
What worked for me was extending the Maui DatePicker into my own date picker that has a single method Open()
Connect the tap gesture in the date picker to call Open()
void Open() {
#if ANDROID
if (this.Handler is IDatePickerHandler handler) {
handler.PlatformView.PerformClick();
}
#else
(this as IView).IsFocused = false;
this.Focus();
#endif
}
Is there any update on this? It still isn't working in the latest version of Maui as of 13/08/24
Supposedly there's a fix but it's stuck in review. Maui team, can you please review/accept the pull? We're converting from Xamarin and this bug is preventing us from doing so.
This fix is needed... will it be fixed soon?
Also waiting for this fix...
after almost one year still not fixed!
my workaround:
private DatePickerDialog mDialog;
protected override DatePickerDialog CreateDatePickerDialog(int year, int month, int day)
{
mDialog = base.CreateDatePickerDialog(year, month, day);
return mDialog;
}
protected override void ConnectHandler(MauiDatePicker platformView)
{
base.ConnectHandler(platformView);
mDialog.ShowEvent += OnDialogShown;
mDialog.DismissEvent += OnDialogDismissed;
}
private void OnDialogShown(object sender, EventArgs e)
{
VirtualView.IsFocused = true;
}
private void OnDialogDismissed(object sender, EventArgs e)
{
VirtualView.IsFocused = false;
}
Description
Datepicker focus and unfocus event are not firing on android, but they do on windows machine.
Steps to Reproduce
Create default maui app add datepicker add focus/unfocus events start android emulator watch breakpoints not hit on events
Link to public reproduction project repository
https://github.com/Eves101/DatepickerFocusIssueAndroid
Version with bug
8.0.3
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?
No response
Relevant log output
No response