Reorder Items in Grouped ListView

This help topic will provide an overview on how you could enable reordering feature of the ListView control when its items are grouped.

Before proceeding, check the Reorder Items topic which describes in details the reordering functionality of the ListView.

When the items of the ListView are grouped by certain criteria and the end user drags/starts reordering an item, the dragged item can be added to a different group. Since this depends on the items' relation, to handle the scenario, you need to subscribe to the ListView Reorder command and manually update the dragged item details.

The ReorderEndedCommandContext gives you access to the following properties:

  • Item—Refers to the data item that is being interacted with.
  • DestinationItem—Refers to the data item that corresponds to the location where the dragged item has been released.
  • Group—Gets the group containing the data item that is being interacted with.
  • DestinationGroup—Refers to the group that corresponds to the location where the dragged item has been released.
  • Placement (of type ItemReorderPlacement)—Indicates whether the dragged item should be placed before or after the destination item.

Below you can find a sample implementation.

The RadListView definition with the PropertyGroupDescriptor and Reorder command applied:

Include the telerik namespace:

xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui" 

Create a ViewModel class containing a collection of Event objects as well as a Reorder command implementation considering the Events will be grouped according to the Day property. Inside the Reorder command you will have access to some useful details through the ReorderEndedCommandContext such as:

And the business model:

The following image shows the result:

ListView Reorder in grouped scenario

See Also

In this article
Not finding the help you need?