MicrosoftDocs / winrt-api

WinRT reference content for developing Microsoft Universal Windows Platform (UWP) apps
Creative Commons Attribution 4.0 International
231 stars 499 forks source link

Document keyboard rearrange support via CanReorderItems #1814

Open citelao opened 4 years ago

citelao commented 4 years ago

Enabling CanReorderItems, beyond just enabling mouse- and touch-based drag-and-drop reorder of ListView elements, also enables keyboard rearrange support for these items.

Specifically, it enables users to rearrange items with the Alt+Shift+arrow keys hotkey, which is a common rearrange hotkey for Shell components like Start tiles.

We should document this behavior:


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

citelao commented 4 years ago

It is also not clear to me how these hotkeys work. Do they end up firing drag and drop events, or do they simply rearrange the ObservableCollection?

citelao commented 4 years ago

After testing, the hotkeys seem to act like the latter option (simply rearrange the ObservableCollection). They fire two CollectionChanged on the ItemsSource (an add and remove).

This is different from drag-and-drop, which fires the DragStarted event, then similar CollectionChanged events, then DragCompleted events.

This is important to clarify, since I can imagine devs implementing business logic on the DragCompleted event (since it's simpler), and this would not support the hotkey rearrange case.