-
Notifications
You must be signed in to change notification settings - Fork 111
994865- Fixed selection issues on Picker Controls #303
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where selection gets reset when setting certain selected dates/times in picker controls. The root cause was that the picker was rendering based on the selected date on each tab switch. The fix updates the behavior to render based on internal values instead.
Key Changes
- Added
FooterTemplate == nullcheck toIsScrollSelectionAllowed()to prevent scroll selection when custom footer templates are used - Refactored duplicate code from
OnOkButtonClickedinto newUpdateInternalValueToSelection()helper methods across all picker types - Added
GetScrollSelectedDateTime()helper inSfDateTimePickerto retrieve the correct date/time for rendering - Enhanced
OnPopupClosed()inSfDateTimePickerto reset internal selection and update header text when popup is cancelled
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| maui/src/Picker/PickerBase.cs | Added FooterTemplate null check to IsScrollSelectionAllowed() to disable scroll selection with custom footer templates |
| maui/src/Picker/SfPicker.cs | Refactored OnOkButtonClicked logic into UpdateInternalValueToSelection() method for better code organization |
| maui/src/Picker/SfDatePicker.cs | Extracted UpdateInternalValueToSelection() method to eliminate code duplication |
| maui/src/Picker/SfTimePicker.cs | Added UpdateInternalValueToSelection() method following the same pattern as other picker types |
| maui/src/Picker/SfDateTimePicker.cs | Added UpdateInternalValueToSelection() and GetScrollSelectedDateTime() helpers, enhanced OnPopupClosed() to properly reset internal selection on cancel, fixed GenerateMinuteColumn to use parameter instead of property |
Comments suppressed due to low confidence (1)
maui/src/Picker/PickerBase.cs:217
- Both branches of this 'if' statement return - consider using '?' to express intent better.
if (Mode != PickerMode.Default && FooterView.Height != 0 && FooterView.ShowOkButton && FooterTemplate == null)
{
return true;
}
else
{
return false;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Root Cause of the Issue
It gets rendered based on selected date on each tab switch.
Description of Change
Updated Behavior to render based on internal values.
Issues Fixed
This PR fixes a bug where selection gets reset when setting certain selected dates/times.
Output
Windows:
WindowsPicker.mp4
Android:
Screen.Recording.2025-12-02.at.11.30.50.AM.mov
Mac:
Screen.Recording.2025-12-02.at.11.26.18.AM.mov
iOS:
Screen.Recording.2025-12-02.at.11.33.40.AM.mov
MR Checklist