Open filipnavara opened 1 year ago
For notes:
Checking Forms, it's the same logic there, copied to MAUI.
(I'm working on pushing a reduced sample; my machine is in a bit of disrepair after yesterday's updates)
Checking Forms, it's the same logic there, copied to MAUI.
I wonder if XF was avoiding the problem number 3 because the mapping was done differently? I only noticed the first two because of the third one.
Updated the sample: https://github.com/filipnavara/CollectionViewIsBroken
Notice that the user selection on tap doesn't "stick". Putting a breakpoint here shows that the item gets instantly deselected: https://github.com/filipnavara/CollectionViewIsBroken/blob/84e9d406ce13d16a84e4ad9b3a5a744a3f585dd3/CollectionViewIsBroken/MainPage.xaml.cs#L86
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
Description
There are at least three problems in the CollectionView
SelectedItem
/SelectedItems
synchronization in iOS handler code:https://github.com/dotnet/maui/blob/9fdfc84566c4ad9581459201dc3a10833409b6e1/src/Controls/src/Core/Handlers/Items/iOS/SelectableItemsViewController.cs#L146-L175
ShouldNotBeSelected
method uses reference equality instead ofEquals
. If the item source returns a different instance of an object then this will fail and deselect items.HashSet
could bring this down to more reasonable logarithmic complexity.SelectedItem
/SelectedItems
which in turns runs the selection synchronization unnecessarily:Steps to Reproduce
TBD
Link to public reproduction project repository
https://github.com/filipnavara/CollectionViewIsBroken
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 16.4
Did you find any workaround?
No, short of copying the whole handler code and fixing it myself.
Relevant log output
No response