Description
Description
Using a CollectionView it is not possible to preselect items when mode is set to "multiple". It doesn't work on Windows, iOS or macOS however it does work on Android.
Using the method described here: https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/collectionview/selection#multiple-preselection
Multiple preselection does not work.
No items in the collection view are pre selected even though the collection in the view model does have the correct values.
I cannot find a way to preselect items in the CollectionView on Windows, iOS or macOS. The only way I can find to select items programmatically from the view model is by using the UpdateSelectedItems method and that only seems to work when triggered manually from a button. It does not work in the constructor or even when used in the onAppearing method.
Steps to Reproduce
- Follow the steps described in the following article to set up a collection view and populate it with preselection in a view model
https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/collectionview/selection#multiple-preselection - Run the solution and observe the items are not pre selected on Windows, iOS or macOS. However they are preselected on Android.
Use the attached example solution.
- Run the solution.
- Observe that the items are not pre-selected when the app is first executed, on Windows, iOS and macOS.
- Click the button labelled "Select using Binding" and observe the items are NOT selected.
- Click the button labelled "Select using Method" and observe the items ARE selected.
Link to public reproduction project repository
https://github.com/KeithBoynton/CollectionView
Version with bug
7.0.49
Last version that worked well
Unknown/Other
Affected platforms
iOS, Windows, macOS
Affected platform versions
Latest
Did you find any workaround?
No
Relevant log output
No response