Reordering Items

Seemingly by magic, ListView contains automatic support for drag-and-drop reordering of items. As you drag an item around, the other items even move around to get out of the way! This is pictured in Figure 10.7. Dragging starts instantly for mouse or pen, but for touch the drag must start perpendicular to the panning direction to avoid confusion with the typical panning gesture. This can work end-to-end without any of your own C# code, although ListView does have a DragItemStarting event in case you want to add custom behavior.

Image

FIGURE 10.7 Dragging the red square to a new spot in the ListView works automatically, but you must ...

Get XAML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.