Skip to content

Conversation

@NanthiniMahalingam
Copy link
Contributor

@NanthiniMahalingam NanthiniMahalingam commented Jun 13, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Issue Details

  • The Picker control does not display a selected item indication on the Android platform.

Root Cause

  • On Android, when an item is selected in the Picker dialog, there is no visual indication of the selected item due to missing support for selection highlighting.

Description of Changes

  • Implemented the SetSingleChoiceItems method to visually indicate the selected item in the Picker dialog.
  • Used MaterialAlertDialogBuilder to enable customization of the Picker dialog appearance.
  • Applied materialAlertDialogTheme to maintain consistent styling for both light and dark themes.

Validated the behaviour in the following platforms

  • Android
  • Windows ,
  • iOS,
  • MacOS

Issues Fixed

Fixes #29633
Fixes #19681

Output Images
Android

Before After
Light Mode
Dark Mode

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jun 13, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@NanthiniMahalingam! 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 the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jun 13, 2025
@NanthiniMahalingam NanthiniMahalingam changed the title Fix 29633 [Android] Fixed Picker Does Not Show Selected Item Highlight Jun 13, 2025
@NanthiniMahalingam NanthiniMahalingam marked this pull request as ready for review June 13, 2025 12:58
Copilot AI review requested due to automatic review settings June 13, 2025 12:58
@NanthiniMahalingam NanthiniMahalingam requested a review from a team as a code owner June 13, 2025 12:58
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 the Android Picker control issue by introducing visual indication for the selected item in the Picker dialog.

  • Updated styles to include the materialAlertDialogTheme for consistent theming.
  • Replaced the AppCompatAlertDialog with MaterialAlertDialogBuilder and changed the item selection method to SetSingleChoiceItems for pre-selecting the current item.
  • Added automated tests and a host app sample to verify the new behavior.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

File Description
src/Core/src/Platform/Android/Resources/values/styles.xml Added materialAlertDialogTheme reference for consistent theming.
src/Core/src/Handlers/Picker/PickerHandler.Android.cs Updated dialog creation to use MaterialAlertDialogBuilder and SetSingleChoiceItems for selection highlighting.
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29633.cs Added a test to ensure the Picker displays a selected item highlight.
src/Controls/tests/TestCases.HostApp/Issues/Issue29633.cs Added a sample page demonstrating the highlighted Picker behavior.

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen PureWeen added this to the .NET 9 SR9 milestone Jun 25, 2025
@PureWeen PureWeen moved this from Todo to Ready To Review in MAUI SDK Ongoing Jun 25, 2025
Comment on lines -112 to +113
using (var builder = new AppCompatAlertDialog.Builder(Context))
using (var builder = new MaterialAlertDialogBuilder(Context))
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to switch the control? I worry that for net9 this may cause issues with styling as none of the other dialogs are material. We got things like buttons and toolbars, but this full switch may need to wait for net10.

The single selection does exist:
https://developer.android.com/reference/androidx/appcompat/app/AlertDialog.Builder#setSingleChoiceItems(java.lang.CharSequence[],int,android.content.DialogInterface.OnClickListener)

Comment on lines 18 to +19
<item name="alertDialogTheme">@style/MauiAlertDialogTheme</item>
<item name="materialAlertDialogTheme">@style/MauiAlertDialogTheme</item>
Copy link
Member

Choose a reason for hiding this comment

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

I see we use the same material dilog style for both material and app compat, but still might be worth not changing too much in net9.

Maybe for net10 we switch all the pickers to material? But that is a different issue.

@github-project-automation github-project-automation bot moved this from Ready To Review to Changes Requested in MAUI SDK Ongoing Jun 27, 2025
@NanthiniMahalingam NanthiniMahalingam changed the base branch from main to net10.0 June 27, 2025 13:44
kubaflo and others added 9 commits June 27, 2025 19:20
…net#26153)

* Don’t call NSAttributedString with HTML from a background thread

* Added a UITest

* Refactor

* add more comments and move to Controls

---------

Co-authored-by: Matthew Leibowitz <[email protected]>
…ge class (dotnet#29138)

* Fix for GraphicsView ImagePaint

* update for the graphics view imagePaint

* Added testcase

* Implementation for Downsize

* Revert "Added testcase"

This reverts commit ef22fa8.

* Added test case

* Added CreateResizedMethod

* Implemented Resize method

* Fix modification

* Added testcase

* Revert "Added test case"

This reverts commit a79de0d.

* Updated the changes

* Update changes

* Updated the testcase

* Commited the changes

* Updating code

* Update TestCase

* Code Update

* Modify TestCase

* TestCase Updation

* Code update

* Adding Snapshots

* Added snapshots

* Revert "Added snapshots"

This reverts commit cac6f45.

* Refactor code
* Initial plan for issue

* Update TSA areaPath from "DevDiv\\VS Client - Runtime SDKs\\MAUI" to "DevDiv\\.NET MAUI\\MAUI"

Co-authored-by: Aguilex <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Aguilex <[email protected]>
* [ci] try do full build on dnceng

Update stage-build.yml

Update stage-build.yml

Update stage-build.yml

Update stage-build.yml

Update stage-build.yml

Update stage-build.yml

* Remove the jdk step

* Fix provisioning

* [tests] Try fix GC flaky tests

* [tests] Refactor to use GC test helpers

* Build on macos and windows

* remove pool

* Fix display name

* try this

* try again

* Revert "try this"

This reverts commit f55e3c7.

* Revert "try again"

This reverts commit 85eab97.

* again

* Build platform

* again

* buildConfigurations

* go back

* Release

* variable

* Add prepare steps

* again

* Buildplatform

* OS

* add vmImage

* Fix build script

* Try fix TestHelper collect

* Fix _buildScriptMacOS

* Add TreatWarningsAsErrors variable

* Try fix path

* Fix paths

* Try fix leaks

* Refactor _BuildConfig

* again

* Fix pack log

* -warnAsError 0

* Try this setting

* Fix scripts

* Add Helix

* Add Helix script

* Add helix

* change name

* Try again

* Try restore first

* Add helix cmd

* Add missing parameters

* No node reuse

* Setup machine first

* try again

* try condition

* again

* again

* Fix

* ident

* again

* if

* again

* Build and pack

* Update .net9 eng

* Try helix in debug

* fix bl

* remove bl

* don t run unit test

* Run tests in release/debug

* Try again

* Fix stage

* Try fix script

* Build buildstasks

* we need restore on this too

* Try $(Build.SourcesDirectory)

* Fix variables

* Update

* this works?

* [iOS] Add CodesignRequireProvisioningProfile=false

* [tests] Fix more leak tests

* Just run xunit tests for now

* Try publish missing assemblies

* [ci] Update arcade versions

* add TreatWarningsAsErrors=$(TreatWarningsAsErrors

* Try -nowarn

* Try fix display names

* back

* test_helix_unit_tests

* again

* Test

* Try set friendly name

* Try run other tests

* Skip failing test

* Fix name

* Revert "Try set friendly name"

This reverts commit af22e7c.

* Try fix test warn

* Fix warn as error

* Add more tests

* Fix helix

* try run on mac too

* [testing] Skipping some tests don t work on helix

* [tests] Skip some failing tests

* Try to spend more time on build mac

* Publish needed packages

* [tests] don t run resizetizer tests

* [tests] Cleanup testhelper

* [ci] Update xharness

* [ci] Try to pass env variable to integration tests

* Try again

* Update AppleTemplateTests.cs

* Update TestHelpers.cs

* Update TestHelpers.cs

* dont run iOS tests on dotnet previous

* [testing] Fix helper method

* [testint] Don t skip BindingUnsubscribesForDeadTarget
)

* Add overrides to Help with Obsoleting Compatibility.Layout

* - fix spelling

* - fix API txt file

* - fix comments

* - tizen
* Adding different options to generate adb keys

* More changes
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copilot AI and others added 17 commits June 27, 2025 19:25
* Initial plan for issue

* Update README with link to .NET 10

Co-authored-by: rachelkang <[email protected]>

* Update date format for .NET 10 announcement

Co-authored-by: mattleibow <[email protected]>

* Remove .NET 10 entry from README based on feedback

Co-authored-by: jsuarezruiz <[email protected]>

* Re-add .NET 10 link with just the year 2025

Co-authored-by: jsuarezruiz <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: rachelkang <[email protected]>
Co-authored-by: mattleibow <[email protected]>
Co-authored-by: jsuarezruiz <[email protected]>
…tnet#30117)

* Initial plan for issue

* Fix update-cgmanifest.ps1 to generate deterministic output

Co-authored-by: mattleibow <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: mattleibow <[email protected]>
…ines (dotnet#30230)

* Initial plan

* Add code formatting instructions to copilot-instructions.md

Co-authored-by: mattleibow <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: mattleibow <[email protected]>
* Build the project forst before formatting

* We may need to restore...

* Update dotnet-format-daily.yml
…sisBannedApiAnalyzers to 4.14.0 (dotnet#30213)

* Initial plan

* Update analyzer versions and fix initial Graphics API issues

Co-authored-by: PureWeen <[email protected]>

* Add missing public APIs for netstandard2.0 and netstandard2.1 Core project

Co-authored-by: PureWeen <[email protected]>

* Fix Controls.Core public API issues for netstandard builds

Co-authored-by: PureWeen <[email protected]>

* Fix Controls.Core compile errors by adding missing public APIs for all target frameworks

Co-authored-by: PureWeen <[email protected]>

* Fix iOS public API duplicates by removing entries already in Shipped.txt

Co-authored-by: PureWeen <[email protected]>

* Fix MacCatalyst public API duplicates by removing iOS lifecycle events already in Shipped.txt

Co-authored-by: PureWeen <[email protected]>

* - fix iOS

* - fix catalyst and ios

* - fix

* - fix windows

* - fix windows

* Fix Maps project build errors by adding missing public API declarations for MapElementHandlerUpdate record

Co-authored-by: PureWeen <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: PureWeen <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>
…ldNotHangOrCrash in CI that occasionally fails (dotnet#30239)

* fixed flaky test 8870

* Update src/TestUtils/src/UITest.Appium/HelperExtensions.cs

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
@jsuarezruiz
Copy link
Contributor

I noticed the PR might include some unintended changes, possibly due to a misstep during rebase. Would you mind taking a quick look to confirm?

@NanthiniMahalingam
Copy link
Contributor Author

Closing this one in favor of #30345

@github-project-automation github-project-automation bot moved this from Changes Requested to Done in MAUI SDK Ongoing Jul 1, 2025
@NanthiniMahalingam NanthiniMahalingam deleted the fix-29633 branch July 21, 2025 07:33
@github-actions github-actions bot locked and limited conversation to collaborators Aug 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

I9- EnumPicker on MacCatalyst and Android platforms displays items abnormally Picker doesn't show selected item on Android

8 participants