Get new order if list is populated from a string array.

I populate a Listview like this:

List<string> rgszCurrentListItems = new List<string>();

rgszCurrentListItems.Add("1");

rgszCurrentListItems.Add("2");

rgszCurrentListItems.Add("3");

var stringList = new ObservableCollection<string>(rgszCurrentListItems);

SpeciesList.ItemsSource = stringList;


I have drag sorting enabled, I can drag the items in the list view to re-arrange.

How do I get the new order? When I look at ItemsSource after reordering the list, it still has the original order of 1, 2, 3.


I am using the same xaml layout this page shows:

https://help.syncfusion.com/maui/listview/item-drag-and-drop 

Under the title:

Drag indicator view

with binding like this:

<Label x:Name="textLabel" Text="{Binding .}" ....


1 Reply

SY Suthi Yuvaraj Syncfusion Team February 12, 2024 02:07 PM UTC

Hi Phunction,

We have checked the reported query , you can reorder the collection  by setting the DragDropController.UpdateSource property to true. Please refer the below documentation for more reference.

UG Link :https://help.syncfusion.com/maui/listview/item-drag-and-drop#reorder-the-underlying-collection

Please let us know if you have any concerns.

Regards,

Suthi Yuvaraj





Loader.
Up arrow icon