[Android] Remove ripple effect on CollectionView item when SelectionMode is None #7615
Conversation
Previously,
The current changes update I'll revert changes in In my opinion, the better implementation here would have been maintaining only Right now, it seems possible to have selections like these:
To me, this does not make sense. You could easily verify this if you go to Selection Galleries -> Selection Modes on iOS.
|
SelectedItems and SelectedItem are completely independent properties. This is intentional. SelectionMode should be thought of as a way to determine which (if any) of these properties is currently being displayed/modified by the native control:
Tying these properties together causes some subtle inconsistencies and issues. For instance, and the moment this PR is setting SelectedItem and SelectedItems to So if we were going to keep going in the direction of "SelectedItem and SelectedItems depend on SelectionMode", to keep internall consistent we'd have to enforce some rules:
The PR currently does 1; we'd have to add some validation logic to the setters to enforce 2. As soon as we do this, the order of the properties in XAML becomes important. With a full version of this PR in place, this XAML:
has a different result than:
The first example will have nothing selected, the second will have a selected item. And we haven't yet taken the idea that "SelectedItem/SelectedItems should make 'sense' with the SelectionMode" to its logical conclusion. Moving from Single to Multiple mode and vice versa would need to make sense. We need more rules. What happens if I move from Single to Multiple - do I clear out the selection or do I keep the single selected item as part of SelectedItems? If I keep the single item, do I still retain it in SelectedItem or do I clear that value? How about the other way? If I move from Multiple SelectedItems to a Single SelectedItem, do I clear the selected items or keep one of them? If I keep one, which one? Do I remove the others from SelectedItems? All of these are answerable and, with a little effort, things we could handle in the code. But they require additional complexity in Core for all the validation logic and add more weird XAML ordering issues. And if we make all those decisions, it makes the control less flexible for developers. Right now, a developer can decide whether or not to keep a single selected item when switching to Multiple, or which (if any) item to keep when moving from Multiple to Single. That's between them and their view model. tl;dr; - No to those selection mode changes. |
@hartez I reverted the changes in Core. If keeping |
…ode is None (xamarin#7615) * fix ripple effect * revert changes in core
…ode is None (xamarin#7615) * fix ripple effect * revert changes in core
Description of Change
Fixes a visual error with selection mode changes on Android / CollectionView. There is also a change in
Core
, which I'd like to discuss with the team to decide whether it should be merged or dismissed.Issues Resolved
Testing Procedure
Please follow the test steps in #6051. I'll update this section with more detailed instructions if the changes in
SelectableItemsView
are approved.PR Checklist