locked
Drag and Drop labels in Xamarin Forms App RRS feed

  • Question

  • User388125 posted

    I have to develop a cross-platform app in Xamarin forms and its one of the requirements is to be able to drag and drop dynamically generated labels between different views on the same UI (i.e. check the image). The drag and drop should have a visual effect. I have generated the dynamic labels but I am not sure how to implement drag and drop functionality. Can anyone guide me regarding the best choice of controls here like the layouts (i.e. Grid, stack layout, absolute layout) containing the labels? Also, do I need to write separate code for implementing the drag and drop on Android and IoS? I will really appreciate if someone can point out the right resource. I have googled but there is not any useful tutorial. Some of the tutorials like this ListView DragDropSort are suggesting writing separate code for Android and IoS platforms.

    Monday, August 12, 2019 9:03 AM

All replies

  • User388125 posted

    The attached image shows the desired UI view. Desired UI Preview

    Monday, August 12, 2019 9:05 AM
  • User369978 posted

    Check the following two samples.

    https://github.com/CrossGeeks/DragViewSample https://github.com/johnshardman/XF_DragAndDrop

    They both support iOS and android only .

    Monday, August 12, 2019 9:48 AM
  • User388125 posted

    @ColeX I have already come across with these two. But for some reasons, they are working properly. For example, in the DragViewSample, I can never see this drag effect which is supposed to work as shown in the demo. All I can see is a listview with different items as shown in the image attached. No drag and drop

    Monday, August 12, 2019 1:42 PM
  • User89714 posted

    @ColeX said: Check the following two samples.

    https://github.com/CrossGeeks/DragViewSample https://github.com/johnshardman/XF_DragAndDrop

    They both support iOS and android only .

    @DavidOrtinau @ColeX @RendyDelRosario - any chance that a UWP version might be added, and the whole lot integrated into Xamarin.Forms? In my app code, I have a cleaned up version of what appears in my old Github repository. If somebody has time to develop drag&drop support for UWP and integrate the whole into Xamarin.Forms, I'll take the time to update my Github version of the Android and iOS bits if it could help.

    Monday, August 12, 2019 2:18 PM
  • User369978 posted

    @junejo_aisha

    Click the image first , then drag it .

    Monday, August 12, 2019 2:49 PM
  • User388125 posted

    @ColeX I am doing this already :(

    Monday, August 12, 2019 3:12 PM
  • User89714 posted

    @junejo_aisha said: @ColeX I am doing this already :(

    As per other thread (let's stick to this one to avoid confusion), try using a physical device instead of a simulator.

    Monday, August 12, 2019 3:19 PM
  • User388125 posted

    I have the Samsung tab3, I will deploy on it and let you know. Many thanks for your kind support. I hope it will be sorted out.

    Monday, August 12, 2019 3:21 PM