Skip to content

Conversation

@HadayaRahman-SF4673
Copy link
Collaborator

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

  • Have you ensured in iOS, Android, WinUI, and macOS(if supported)?
  • If there is any API change, did you get approval from PLO through JIRA Tasks?-N/A
  • Is there any existing behavior change of other features due to this code change?
  • Did you perform the automation / manual testing against your fix?-N
  • Did you record this case in the unit test or UI test?-N/A
  • Have you suppressed any warning or binding errors?-N/A
  • Does it need localization? If so did you ensure the cases mentioned in this link?-N/A
  • Whether the new APIs and its comments are added as per standard?-N/A
  • Did you ensure the cases mentioned in this link?-N/A
  • Did you ensure the fix (if applicable) met accessibility requirements?
  • If you added any interaction related code, have you used touch and gesture APIs from core project?-N/A
  • Does it contain code that reflects any internal framework API?-N/A
  • Did you ensure the cases mentioned in this link?-N/A
  • Did you ensure RTL?-N/A
  • Did you test the memory leak with the fix?-N/A
  • Did you ensure the ? Check this link to know more about performance optimization and how to automate?-N/A
  • If you use a third-party package, did you get approval to use it? If not, please get approval before merging.-N/A

@MuniappanSubramanian MuniappanSubramanian changed the title 994865-Fixed-Selection-Issue 994865- Fixed selection issues on Picker Controls Dec 4, 2025
@PaulAndersonS PaulAndersonS requested a review from Copilot December 8, 2025 12:48
Copy link
Contributor

Copilot AI left a 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 == null check to IsScrollSelectionAllowed() to prevent scroll selection when custom footer templates are used
  • Refactored duplicate code from OnOkButtonClicked into new UpdateInternalValueToSelection() helper methods across all picker types
  • Added GetScrollSelectedDateTime() helper in SfDateTimePicker to retrieve the correct date/time for rendering
  • Enhanced OnPopupClosed() in SfDateTimePicker to 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.

@PaulAndersonS PaulAndersonS merged commit 62d8f2a into main Dec 10, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants