Open dbriard opened 1 year ago
There were issues with SelectionModel supporting hierarchical selection. Therefore, that was removed. It was instead planned to add a separate TreeSelectionModel I believe.
This was discussed over a year ago and I would have to dig for the PR. It was with the ItemsControl or perhaps even the ItemsRepeater work.
Edit: Nevermind, I found it: https://github.com/AvaloniaUI/Avalonia/pull/4533#issuecomment-679849357
I run into a problem trying to make a grouped list view like this one:
and finally I get something to work using a sample from UWP ItemsRepeater with Selection: https://github.com/microsoft/microsoft-ui-xaml/tree/main/dev/Repeater/TestUI/Samples/SelectionSample/Grouped
I know that Avalonia have a SelectionModel class, it it is not as complete as the one of UWP. The UWP SelectionModel can use a IndexPath object to track the selection. It allow SelectedIndex as int, but also (groupIndex, itemIndex) for 2-level hierarchy and a list of int for deeper level of hierarchy.
I used code from MordernWPF for SelectionModel, but that would be super useful if Avalonia's SelectionModel can be updated to use IndexPath.
For example, for the above list, I needed: SelectionModel.IsSelected(groupIndex, RepeatedIndex).Value
with index path looking like that in ModernWPF