Description
Support drag-and-drop item reordering in the CollectionView.
The CollectionView handlers should use the built-in item reordering functionality provided by the platforms:
Reordering should require the CollectionView.ItemsSource be bound to an IList. The platform handlers will use the Remove & Insert methods on the IList to complete the reorder operation.
Example
https://github.com/billvenhaus/ReorderableCollectionView.Maui

(Public) API Changes
Place the new reorder functionality in a separate class that the CollectionView can inherit.
CollectionView
public class CollectionView : ReorderableItemsView
{
}
ReorderableItemsView
public class ReorderableItemsView : GroupableItemsView
{
public static readonly BindableProperty CanMixGroupsProperty;
public bool CanMixGroups { get; set; }
public static readonly BindableProperty CanReorderItemsProperty;
public bool CanReorderItems { get; set; }
public event EventHandler ReorderCompleted;
}
Properties
| API |
Description |
CanReorderItems |
Gets or sets a value that indicates whether items in the view can be reordered through user interaction. |
CanMixGroups |
Gets or sets a value that indicates whether items from different groups can be mixed during reordering. |
Events
| API |
Description |
ReorderCompleted |
Raised whenever reordering user interaction completes. |
Usage Scenarios
Basic Item Reordering
The developer has an app which manages the playlist for a media player. The user needs to be able to make changes to the track order by rearranging the songs with drag-and-drop. How can the developer achieve this UI with the proposed API?
In order to achieve this behavior, the developer should set the CollectionView.CanReorderItems property to true. They can be notified of changes to the song order by subscribing to the ReorderCompleted event. At that point the developer can save the changes to the playlist storage location.
Reordering with Grouped Sources (Mixing Items)
The developer has a grouped data source & wishes to mix items. Items in group A can be placed in group B, and items in group B can be placed in group A. How can the developer achieve this with the proposed API?
In order to achieve this behavior, the developer should set both CollectionView.CanReorderItems & CollectionView.CanMixGroups to true.
Detailed Events
The ReorderCompleted is a basic EventHandler that doesn't provide any information about the item that moved. How can the developer determine which item moved & where it moved to?
The developer should bind the CollectionView.ItemsSource to an ObservableCollection if they need to know specific details about the item that moved. The CollectionChanged event of the ObservableCollection can provide that information.
Backward Compatibility
Minimum API Levels:
- Available on all API levels.
Breaking Changes:
Unsupported Platforms:
- Windows reordering only works with ObservableCollections
- Windows reordering does not support grouped sources (see here)
Difficulty
Medium
Description
Support drag-and-drop item reordering in the
CollectionView.The
CollectionViewhandlers should use the built-in item reordering functionality provided by the platforms:true.Reordering should require the
CollectionView.ItemsSourcebe bound to anIList. The platform handlers will use theRemove&Insertmethods on theIListto complete the reorder operation.Example
https://github.com/billvenhaus/ReorderableCollectionView.Maui
(Public) API Changes
Place the new reorder functionality in a separate class that the
CollectionViewcan inherit.CollectionView
ReorderableItemsView
Properties
CanReorderItemsCanMixGroupsEvents
ReorderCompletedUsage Scenarios
Basic Item Reordering
The developer has an app which manages the playlist for a media player. The user needs to be able to make changes to the track order by rearranging the songs with drag-and-drop. How can the developer achieve this UI with the proposed API?
In order to achieve this behavior, the developer should set the
CollectionView.CanReorderItemsproperty totrue. They can be notified of changes to the song order by subscribing to theReorderCompletedevent. At that point the developer can save the changes to the playlist storage location.Reordering with Grouped Sources (Mixing Items)
The developer has a grouped data source & wishes to mix items. Items in group A can be placed in group B, and items in group B can be placed in group A. How can the developer achieve this with the proposed API?
In order to achieve this behavior, the developer should set both
CollectionView.CanReorderItems&CollectionView.CanMixGroupstotrue.Detailed Events
The
ReorderCompletedis a basicEventHandlerthat doesn't provide any information about the item that moved. How can the developer determine which item moved & where it moved to?The developer should bind the
CollectionView.ItemsSourceto anObservableCollectionif they need to know specific details about the item that moved. TheCollectionChangedevent of theObservableCollectioncan provide that information.Backward Compatibility
Minimum API Levels:
Breaking Changes:
Unsupported Platforms:
Difficulty
Medium