994865- Fixed selection issues on Picker Controls#303
Merged
PaulAndersonS merged 2 commits intomainfrom Dec 10, 2025
Merged
Conversation
MuniappanSubramanian
approved these changes
Dec 4, 2025
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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