Skip to content

Conversation

@prakashKannanSf3972
Copy link
Contributor

@prakashKannanSf3972 prakashKannanSf3972 commented Apr 2, 2025

Root Cause:

The Picker does not refresh its visual states when the TextColor property changes, causing stale text color rendering after page navigation or re-entry. While TextColorResourceKeys correctly map the resources, the UI does not update unless the theme resources are explicitly refreshed.

Description of Change:

Improved the handling of TextColorResource updates to ensure text color changes are properly reflected after page navigation or re-entry. This enhancement prevents stale visual states in the Picker control, ensuring a consistent and accurate UI appearance across navigation scenarios.

  • DatePicker Reference :
    platformDatePicker.RefreshThemeResources();
    }
    // ResourceKeys controlling the foreground color of the CalendarDatePicker.
    // https://docs.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.calendardatepicker?view=windows-app-sdk-1.1

Issues Fixed

Fixes #28536

Tested the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Output

Before After
Before_Fix.1.mp4
After_Fix.1.mp4

@dotnet-policy-service
Copy link
Contributor

Hey there @@prakashKannanSf3972! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Apr 2, 2025
@prakashKannanSf3972 prakashKannanSf3972 marked this pull request as ready for review April 2, 2025 07:38
Copilot AI review requested due to automatic review settings April 2, 2025 07:38
@prakashKannanSf3972 prakashKannanSf3972 requested a review from a team as a code owner April 2, 2025 07:38
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 addresses a visual state issue with the Picker control on Windows by ensuring that text color updates are properly reflected after page navigation or re-entry.

  • Added a call to RefreshThemeResources in the PickerExtensions update method.
  • Introduced automated tests in TestCases.Shared.Tests and TestCases.HostApp to verify the fix.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/Core/src/Platform/Windows/PickerExtensions.cs Updated UpdateTextColor to refresh theme resources after TextColor changes.
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28536.cs Added an automated test to verify Picker visual state consistency after navigation.
src/Controls/tests/TestCases.HostApp/Issues/Issue28536.cs Added a host application page for testing the navigation scenario involving the Picker visual state update.

nativeComboBox.Foreground = platformBrush;
}

nativeComboBox.RefreshThemeResources();
Copy link

Copilot AI Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a code comment to explain why RefreshThemeResources is being called here, to aid future maintainers in understanding its necessity for updating the theme resources after a TextColor change.

Copilot uses AI. Check for mistakes.
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen changed the base branch from main to inflight/current April 2, 2025 15:34
@rmarinho
Copy link
Member

rmarinho commented Apr 7, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen PureWeen merged commit 4c19a52 into dotnet:inflight/current Apr 8, 2025
19 checks passed
bhavanesh2001 pushed a commit to bhavanesh2001/maui that referenced this pull request Apr 11, 2025
PureWeen pushed a commit that referenced this pull request Apr 11, 2025
PureWeen pushed a commit that referenced this pull request Apr 16, 2025
sheiksyedm pushed a commit to sheiksyedm/maui that referenced this pull request Apr 17, 2025
NanthiniMahalingam pushed a commit to NanthiniMahalingam/maui that referenced this pull request Apr 17, 2025
github-actions bot pushed a commit that referenced this pull request Apr 18, 2025
PureWeen added a commit that referenced this pull request Apr 23, 2025
### Description of Change

## .NET MAUI Release Notes - Inflight/Candidate

## What's Changed

### MAUI Product Fixes
* Fix CarouselView layout SR6 regressions by @albyrock87 in
#29035
* Revert "[Android] picker - focus/unfocus events (#28122)" by @PureWeen
in https://github.com/dotnet/maui/pull/1fb5164929
* [Windows] Fixed the flyout content width not being set correctly after
updating to WinUI SDK 1.7 by @Tamilarasan-Paranthaman in
#28996
* [Android] picker - focus/unfocus events by @kubaflo in
#28122
* [XC] add IRootObjectProvider by @StephaneDelcroix in
#28310
* [iOS] Fix for the File.ContentType from MediaPicker not being in valid
MIME format by @SyedAbdulAzeemSF4852 in
#28842
* [Android] Fixed the Incorrect Text Color Applied to Selected Tab in
TabbedPage by @Ahamed-Ali in #28844
* [iOS] Fix FlyoutPage does not respond to changes in the
FlyoutLayoutBehavior property by @devanathan-vaithiyanathan in
#28884
* [Android] Fixed ScalingCanvas.SetBlur not working by
@NirmalKumarYuvaraj in #28911
* [iOS] - Resolved Proper Rendering of Dynamic Header/Footer Updates in
CV2 by @prakashKannanSf3972 in #28641
* [iOS] Fixed the TargetInvocationException Occurs When Selecting
Header/Footer After Changing ItemsLayout in CV2 by @Ahamed-Ali in
#28890
* [Windows] - Fix Visual State Issue with Picker TextColor After
Navigation by @prakashKannanSf3972 in
#28746

### Dependency Updates
* [Windows] Upgrade to Windows App SDK 1.7 by @MartyIX in
#28499

### Testing
* [Testing] Feature Matrix UITest Cases for CollectionView EmptyView
Feature by @NafeelaNazhir in #28679
* Fixed Test case failure in PR 29037 - [2025/04/21] Candidate by
@HarishKumarSF4517 in #29049

**Full Changelog**:
main...inflight/candidate


For more information about inflight process check
https://github.com/dotnet/maui/wiki/Inflight-Branch-Process
@github-actions github-actions bot locked and limited conversation to collaborators May 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-picker Picker community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Navigation breaks VisualState styles for Picker.

4 participants