Drag and Drop items from one listview into another specific listview item

I was wondering if it is possible to drag and drop a item into another listview, but I also need to detect on which item of the other listview the item is being dropped in. 

On the example page it only shows dropping a listview item into a single stacklayout ( Item Reordering in Xamarin ListView control | Syncfusion)


I found another example ( How to drag and drop an item from one to another listview in xamarin.forms | Syncfusion KB ) where it is being showed how to drop an item into another listview, but it only shows how to drop the item into the entire list, not how to drop it into a specific listview item. 

So I need to 'detect' in which listview item the other item is being dropped in, is this possible?


3 Replies

SY Suthi Yuvaraj Syncfusion Team January 26, 2022 11:42 AM UTC

Hi Nicolas, 
We have checked with the reported query “Drag and Drop items from one listview into another specific listview item”, In the example, “Add” operation is used to drop listview item to another listview, as it will add the item to end of the list. 
In Order to drop the item in the specific index, we suggest you to use “Insert(index, item)" method. 
 
Also, you need to detect the index of listview item dropped so that you can use “IndexOf” to display the index of listView item dropped to the another listview. 
 
Please let us know if you need further assistance. 
Regards, 
Suthi Yuvaraj. 



NI Nicolas January 26, 2022 01:20 PM UTC

Hi  Suthi Yuvaraj,


Adding the item to the correct list is not really the problem. The problem is that I want to add it to the right list with hovering/dragging on the 'other listitem'.


So in code-behind there should be some way to determine which item element is being hovered (dragged) on, based on that item I want to use the Add function. And also (related) when dragging not the whole list element should get a different background color, but only the specific list item which the other item is being dragged to. 




LN Lakshmi Natarajan Syncfusion Team January 27, 2022 11:16 AM UTC

Hi Nicolas, 
 
Query  
Response 
So in code-behind there should be some way to determine which item element is being hovered (dragged) on, based on that item I want to use the Add function. 
You can get the dragged item details in the SfListView.ItemDragging event. In the ItemDraggingEventArgs, the ItemData property has the underlying data of the dragging item. 
 
Please refer to our user guidance document regarding the same, 
 
And also (related) when dragging not the whole list element should get a different background color, but only the specific list item which the other item is being dragged to. 
We could not understand this requirement. Please explain your requirement in detail and revert us back with the demo video of your requirement to understand it better. 
 
Meanwhile, we suspect that your requirement is to customize the dragged item. If yes, then the SfListView allows you to customize the dragged item using DragItemTemplate.  
 
Please refer to our user guidance for more reference, 
 
We have modified the sample based on your requirement, 
 
 
Please check our sample and let us know if you need further assistance. 
 
Regards, 
Lakshmi Natarajan 


Loader.
Up arrow icon