Skip to content

[Windows] Fix for Assigning null to the SelectedItem of the CollectionView in the SelectionChanged event does not clear the selection #29288

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

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

Copy link
Contributor

Hey there @@SyedAbdulAzeemSF4852! 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 May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting CollectionView.SelectedItem = null does nothing
1 participant