We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Keeping empty group when reordering


I've just about got my re-ordering working with empty grouping, however my last challenge (i think) is having a group stay in place when you take the last item from it and move it to another group.

I figured i have to add an item to my bound list when the event is a DragAction.start, but trying a variety of combinations of adding and refreshing datasource, sort order etc. i can't get it to cleanly work.

Is there a way to achieve this? Basically i want to:

  1. Select an item to re-order it from one group
  2. drag it to another group
  3. when that dragged item is the last item in the group, an empty item is placed in the group to keep it in place

1 Reply

SY Suthi Yuvaraj Syncfusion Team October 10, 2022 09:08 AM

Hi Mark ,

We have checked the reported query “Keeping empty group when reordering” from our end. We would like to inform you that we can achieve your requirement in the ItemDragging Event in SfListView, By the Group count, you can get the last item of the group and add the empty item with size as zero, the group header is only visible. In this case, the dummy item is still maintained in the collection. We have attached the sample and code snippet for your reference.

Code snippet:

listView.QueryItemSize += ListView_QueryItemSize; listView.DataSource.LiveDataUpdateMode = Syncfusion.DataSource.LiveDataUpdateMode.AllowDataShaping;

this.listView.DragDropController.UpdateSource = true;



private void listView_ItemDragging(object sender, ItemDraggingEventArgs e)



    foreach (var group in listView.DataSource.Groups)


        if (e.Action == DragAction.Start && group.Count <= 1)



            var contact = new BookInfo();

            contact.BookName = "";

            contact.GroupKey = (e.ItemData as BookInfo).GroupKey;

            contact.BookDescription = "";

            listView.DataSource.Groups.AddItemInGroup(contact, group.Count - 1);




private void ListView_QueryItemSize(object sender, QueryItemSizeEventArgs e)


    if (e.ItemType == ItemType.Record && (e.ItemData as BookInfo).BookName == "")


        e.ItemSize = 0;

        e.Handled = true;



Also please refer the below KB for adding empty items with group header

KB link: https://www.syncfusion.com/kb/8491/how-to-display-group-header-without-items-and-add-items-in-the-group-at-run-time

Please let us know if you need further assistance.


Suthi Yuvaraj.

Attachment: GettingStarted_45aa1cbc.zip

Live Chat Icon For mobile
Up arrow icon