Reordering of ListView items by drag and drop

How to reorder items in ListView using drag and drop?

Posts

  • SergeiAverkievSergeiAverkiev RUMember

    There are examples on Java.

    Does anybody have examples of reordering for Monodroid?

  • SavantSavant USMember

    I still need to get the same functionality working. For reference I previously created a SO question

    http://stackoverflow.com/questions/25147107/xamarin-forms-how-to-make-a-draggable-listview

  • pnavkpnavk ✭✭ GEUniversity ✭✭

    I ported the DevBytes Tutorial to C# for use with a Xamarin Android app I am working on:
    https://github.com/pnavk/DraggableListView

  • LeeOlsen.5615LeeOlsen.5615 ✭✭ USUniversity ✭✭

    Tagging for future reference.

  • ArefinArefin ✭✭ USMember, University ✭✭

    @XiaoHippo : Thanks for your advice. Can you please share a complete demo project for listview item re-ordering? It will be great.

    Thanks,
    Arefin

  • alekssmykalekssmyk ✭✭✭ USMember ✭✭✭

    @XiaoHippo Thank you for sharing your code! Can you send a link for the demo, please?

  • ISychev93ISychev93 ✭✭ RUMember ✭✭
    edited May 2016

    Hello!
    Try it - https://github.com/isychev93/Xamarin.Forms-Drag-and-drop-ListView .
    This solution implemented only for iOS, but i hope that Android version will be released soon.

  • JohnHardmanJohnHardman mod GBUniversity mod

    @SergeiAverkiev @Savant @pnavk @LessOlsen.5615 @Arefin @alekssmyk @RogerSchmidlin @ISychev93

    A while ago, I outsourced (at my own expense!) development of drag & drop functionality for use in my first app. There's still work to be done (the biggest bit is that UWP is not working currently), but the code so far can be found at https://github.com/johnshardman/XF_DragAndDrop

    Please dive in and help to complete & enhance :-)

  • ShawnLee.4281ShawnLee.4281 ✭✭ USMember ✭✭
    edited May 2017

    @JohnHardman
    Thanks! You saved my time!!

  • KelvinChengKelvinCheng USMember
    I am still looking for a better way to do listview drag and drop reordering in android using xamarin form. Currently the drag shadow can be dragged sideway. I would like the shadow to be up and down only. Anyone got a solution ? Thanks
  • KelvinChengKelvinCheng USMember
    I am still looking for a better way to do listview drag and drop reordering in android using xamarin form. Currently the drag shadow can be dragged sideway. I would like the shadow to be up and down only. Anyone got a solution ? Thanks
  • EdwardBreyEdwardBrey ✭✭ USMember ✭✭

    I posted an iOS implementation that uses UITableView's reordering functionality.

  • VelocityVelocity ✭✭✭ NZMember ✭✭✭

    @JohnHardman We have implemented on UWP.
    You'll just need to override the ListViewRenderer for Windows and set the following properties to true on the native control:

    • AllowDrop = true
    • CanDragItems = true
    • CanReorderItems = true
    • ReorderMode = Xaml.Controls.ListViewReorderMode.Enabled

    Make sure you bind an ObservableCollection to your ListView items source and you're good to go.
    Simply monitor the CollectionChangedEvent on the ObservableCollection as you drag and drop.

  • JohnHardmanJohnHardman mod GBUniversity mod

    @Velocity - Many thanks. I'll take a look and see if I can integrate that as soon as I have some time.

Sign In or Register to comment.