Skip to content

Fix for CollectionView SelectedItem loses Background after opening and closing a Modal page #26694

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

Merged
merged 6 commits into from
Jan 15, 2025

Conversation

Vignesh-SF3580
Copy link
Contributor

@Vignesh-SF3580 Vignesh-SF3580 commented Dec 18, 2024

Root Cause

The root cause of the issue is that, on iOS, the native property ClearsSelectionOnViewWillAppear is set to true by default. This causes the background color of selected item to reset when navigating back to the CollectionView after modal navigation.

Description of Change

The fix involves setting the ClearsSelectionOnViewWillAppear property to false in the UpdatePlatformSelectionMode method, which is triggered whenever the selection mode is updated. This ensures that the fix is dynamically applied and maintains the selection state across modal navigation, regardless of runtime changes to the selection mode.
Additionally, this issue was identified in CollectionViewHandler2 as well. The same fix was applied to SelectableItemsViewController2 and validated to ensure consistent behavior across both versions of the CollectionView.

Tested the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed

Fixes #22467

Screenshots

Before Issue Fix After Issue Fix
WithoutFix.mov
WithFix.mov

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Dec 18, 2024
@karthikraja-arumugam karthikraja-arumugam added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Dec 18, 2024
@Vignesh-SF3580 Vignesh-SF3580 marked this pull request as ready for review December 18, 2024 17:34
@Vignesh-SF3580 Vignesh-SF3580 requested a review from a team as a code owner December 18, 2024 17:34
@jfversluis jfversluis added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label Dec 19, 2024
@jfversluis
Copy link
Member

/azp run

@jfversluis jfversluis requested a review from rmarinho December 19, 2024 09:31
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@Redth
Copy link
Member

Redth commented Dec 23, 2024

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@rmarinho rmarinho merged commit 758b5e3 into dotnet:main Jan 15, 2025
104 checks passed
@rmarinho rmarinho added this to the .NET 9 SR4 milestone Jan 15, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Feb 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CollectionView SelectedItem loses Background after opening and closing a Modal page
7 participants