KEMBAR78
[Windows] Fix for Assigning null to the SelectedItem of the CollectionView in the SelectionChanged event does not clear the selection by SyedAbdulAzeemSF4852 · Pull Request #29288 · dotnet/maui · GitHub
Skip to content

Conversation

SyedAbdulAzeemSF4852
Copy link
Contributor

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

  • Setting SelectedItem to null in the SelectionChanged event does not clear the selection in the collection view.

Root Cause

  • In the UpdateVirtualSingleSelection method, the VirtualSelectionChanged event handler is temporarily unsubscribed to avoid recursive updates when setting ItemsView's SelectedItem. However, because the selection is updated while the event is unwired, the SelectionChanged event does not fire. As a result, the VirtualSelectionChanged method is never called, and UpdatePlatformSelection method is not invoked. This results in the selection not being cleared.

Description of Change

  • Added a new _ignoreVirtualSelectionChange flag to SelectableItemsViewHandler to prevent unnecessary updates during virtual selection changes.

Issues Fixed

Fixes #10025

Validated the behaviour in the following platforms

  • Windows
  • Android
  • iOS
  • Mac

Output

Before After
Before.mp4
After.mp4

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels May 2, 2025
@jsuarezruiz jsuarezruiz added platform/windows area-controls-collectionview CollectionView, CarouselView, IndicatorView labels May 5, 2025
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@SyedAbdulAzeemSF4852 SyedAbdulAzeemSF4852 marked this pull request as ready for review May 6, 2025 13:38
@SyedAbdulAzeemSF4852 SyedAbdulAzeemSF4852 requested a review from a team as a code owner May 6, 2025 13:38
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Transis-Felipe
Copy link

Please, I'm waiting this fix too.

@PureWeen PureWeen changed the base branch from main to inflight/current June 6, 2025 15:32
@PureWeen PureWeen merged commit 3ca5a43 into dotnet:inflight/current Jun 6, 2025
79 checks passed
github-actions bot pushed a commit that referenced this pull request Jun 7, 2025
…nView in the SelectionChanged event does not clear the selection (#29288)

* Fix for 10025 (Setting the CollectionView's SelectedItem to null on selection changed event does nothing)

* Have added the test case

* Have added the snapshots
github-actions bot pushed a commit that referenced this pull request Jun 10, 2025
…nView in the SelectionChanged event does not clear the selection (#29288)

* Fix for 10025 (Setting the CollectionView's SelectedItem to null on selection changed event does nothing)

* Have added the test case

* Have added the snapshots
github-actions bot pushed a commit that referenced this pull request Jun 10, 2025
…nView in the SelectionChanged event does not clear the selection (#29288)

* Fix for 10025 (Setting the CollectionView's SelectedItem to null on selection changed event does nothing)

* Have added the test case

* Have added the snapshots
github-actions bot pushed a commit that referenced this pull request Jun 11, 2025
…nView in the SelectionChanged event does not clear the selection (#29288)

* Fix for 10025 (Setting the CollectionView's SelectedItem to null on selection changed event does nothing)

* Have added the test case

* Have added the snapshots
github-actions bot pushed a commit that referenced this pull request Jun 11, 2025
…nView in the SelectionChanged event does not clear the selection (#29288)

* Fix for 10025 (Setting the CollectionView's SelectedItem to null on selection changed event does nothing)

* Have added the test case

* Have added the snapshots
github-actions bot pushed a commit that referenced this pull request Jun 16, 2025
…nView in the SelectionChanged event does not clear the selection (#29288)

* Fix for 10025 (Setting the CollectionView's SelectedItem to null on selection changed event does nothing)

* Have added the test case

* Have added the snapshots
github-actions bot pushed a commit that referenced this pull request Jun 16, 2025
…nView in the SelectionChanged event does not clear the selection (#29288)

* Fix for 10025 (Setting the CollectionView's SelectedItem to null on selection changed event does nothing)

* Have added the test case

* Have added the snapshots
github-actions bot pushed a commit that referenced this pull request Jun 19, 2025
…nView in the SelectionChanged event does not clear the selection (#29288)

* Fix for 10025 (Setting the CollectionView's SelectedItem to null on selection changed event does nothing)

* Have added the test case

* Have added the snapshots
PureWeen added a commit that referenced this pull request Jun 21, 2025
For more information about inflight process check
https://github.com/dotnet/maui/wiki/Inflight-Branch-Process

# .NET MAUI Release Notes - inflight/candidate Branch

## MAUI Product Fixes
* [iOS] Fix SwipeView programmatic open when background color is set by
@Shalini-Ashokan in #29765
* [iOS] FormattedText with text color causes stack overflow - fix by
@kubaflo in #29874
* [iOS] Fix AdaptiveTrigger not working as expected by @jsuarezruiz in
#20987
* [iOS] Fix for Flyout title is not broken over multiple lines when you
rotate your screen by @BagavathiPerumal in
#29171
* [Windows] Fix for Assigning null to the SelectedItem of the
CollectionView in the SelectionChanged event does not clear the
selection by @SyedAbdulAzeemSF4852 in
#29288
* Fix TapCoordinates method in Catalyst by @jsuarezruiz in
#29775
* Fixed ItemSpacing on CarouselView resizes items [Android] by
@Dhivya-SF4094 in #29796
* Perf : ButtonContentTypeConverter now using InvariantCulture to parse
double by @antoine-jonathan in #25393
* ToolbarItem behavior with ImageSource iOS - fix by @kubaflo in
#28833
* [Android] Fixed Button Shadow Color Transparency Not Applied Correctly
by @NanthiniMahalingam in #29371
* Don't call NSAttributedString with HTML from a background thread by
@kubaflo in #26153
* [Windows] Implemented the Resize and Downsize functions in the
W2DImage class by @HarishwaranVijayakumar in
#29138
* Templated indicator view - improvements by @kubaflo in
#25642
* Update Issue25946.xaml by @anandhan-rajagopal in
#30025

## Testing
* Fixed Test case failure in PR 26153 - iOS by @kubaflo in
#29906
* Fixed Test case failure in PR 25642 - snapshots by @kubaflo in
#29881
* [Testing] Feature Matrix UITest Cases for RadioButton by
@TamilarasanSF4853 in #29744
* [Testing] Feature Matrix UITest Cases for CollectionView ItemsSource
Feature by @LogishaSelvarajSF4525 in
#29322
* [Testing] Feature Matrix UITest Cases for Stepper by
@nivetha-nagalingam in #29731
* [Testing] Feature Matrix UITest Cases for CheckBox Control by
@anandhan-rajagopal in #29739
* Update the comment for the test properties by @mattleibow in
#27306

## Dependency Updates
* No changes in this category

## Docs
* No changes in this category

## Housekeeping
* [create-pull-request] automated change by @github-actions[bot] in
#29875
* [create-pull-request] automated change by @github-actions[bot] in
#29792
* [create-pull-request] automated change by @github-actions[bot] in
#29760

**Full Changelog**:
origin/main...origin/inflight/candidate
@PureWeen PureWeen added this to the .NET 9 SR9 milestone Jun 23, 2025
rmarinho pushed a commit that referenced this pull request Jun 24, 2025
…nView in the SelectionChanged event does not clear the selection (#29288)

* Fix for 10025 (Setting the CollectionView's SelectedItem to null on selection changed event does nothing)

* Have added the test case

* Have added the snapshots
@github-actions github-actions bot locked and limited conversation to collaborators Jul 24, 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 platform/windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setting CollectionView.SelectedItem = null does nothing

4 participants