xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Bug] Xamarin not allowing to drop an item in Empty area of grouped collection view where more than one item aligned horizontally #14310

Open tusharsjagdale opened 3 years ago

tusharsjagdale commented 3 years ago

Description

  1. I have grouped collection view with 3 items per row and implemented drag-drop functionality onto them so that one item of group 1 can be dragged-dropped to the another group (say group 2) of collection view.
  2. I can able to drop onto the collection view item as well as collection view header/footer template. But not able to drop onto the blank area of collection view (Blank area is because of if I am having 4 items, so 3 items are fitting in one row and 1 item is fitting in another row but there is blank area in which two items can be fitted easily. )

Steps to Reproduce

  1. Take grouped collection view
  2. Add Drag/Drop gesture for the items so that item of one group can be drag/drop to another group
  3. Try to drop item in blank area of collection view

Expected Behavior

  1. There should be mechanism through which user can be able to drop item onto the blank area of grouped collection view

Actual Behavior

  1. Xamarin is not allowing to drop drop item onto the blank area of grouped collection view

Basic Information

Environment

Show/Hide Visual Studio info ``` ```

Build Logs

Screenshots

Reproduction Link

Workaround

NathanJPhillips commented 3 years ago

I have a minimal MVVM project (using Prism) to reproduce this issue that I can share if helpful. The problem comes down to the fact that there doesn't seem to be a template or style for a group in a CollectionView that includes the region for the items in the group. There is a GroupHeaderTemplate for the group header and there is ItemTemplate for items, both of which can have drop handlers, but the region under a group header that doesn't have items in it is not associated with the group. A drop on this area cannot be handled, even by a DropGestureRecognizer set on the whole CollectionView. This means that currently it is impossible to drag and drop items between groups in a CollectionView.

jsuarezruiz commented 3 years ago

Have you seen this example: https://devblogs.microsoft.com/xamarin/collectionview-drag-and-drop/? Could you attach a small sample where reproduce the issue?

NathanJPhillips commented 3 years ago

Reproducer here: TestGroupedDragAndDrop.zip Try dragging an item from one group to another group. Notice that you can drop on the group header, a different handler allows you to drop on other items in the group, but there is no way to drop on the white space to the right of groups that don't contain a multiple of three items.

NathanJPhillips commented 3 years ago

@jsuarezruiz - could you update the labels on this issue assuming this repro is adequate?