Is it possible to customize the multi-selection behavior of ListView in any way? For example, I’d like to allow for continuous ranges of items to be selected, but not individual disjoint items (i.e. the built-in Shift+Click behavior, but disallow the built-in Ctrl/Cmd+Click behavior).
All the methods controlling this behavior in BaseCollectionView are non-virtual and private, so overriding it seems difficult.
As a partial solution I’ve added my own handlers for PointerDown and PointerUp in a derived class to prevent the handlers in BaseCollectionView from receiving them:
RegisterCallback<PointerDownEvent>((evt) =>
{
if (evt.actionKey)
{
evt.StopImmediatePropagation();
}
});
RegisterCallback<PointerUpEvent>((evt) =>
{
if (evt.actionKey)
{
evt.StopImmediatePropagation();
}
});
This effectively removes all Ctrl+Click behavior, but it would be a little nicer if Ctrl+Click could still be used to select or deselect items at either end of the current selected range or to single-select items. Is there a good way to allow this without allowing disjoint selections?