Hello,
===============Update=============
It appears to work well in Windows, but not Android
Yes, the click event is consumed by DisplayAlert and cannot be transmitted to the checkbox in the Android/iOS platform.
For fix this issue, you can implement this ObservableObject object and change it to partial class, then add [ObservableProperty]
to the isInvited property, then this property can be changed at the runtime.
public partial class User:ObservableObject
{
[ObservableProperty]
public bool isInvited;
...
}
After that, we can use Conditional compilation to fix this different platform issue. For iOS and Android, we can change this IsInvited value by ourselves, for windows, you can keep this implement.
[RelayCommand]
void HandleCheckBox(User user) {
#if ANDROID || IOS
if (user.IsInvited is false)
{
user.IsInvited=true;
appService.DisplayAlert("Info", "true", "ok");
}
else
{
user.IsInvited = false;
appService.DisplayAlert("Info", "false", "ok");
}
#elif WINDOWS
if (user.IsInvited is false) {
appService.DisplayAlert("Info", "False", "ok");
} else {
appService.DisplayAlert("Info", "Yes", "ok");
}
#endif
}
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.