roubachof / Sharpnado.CollectionView

A performant list view supporting: grid, horizontal and vertical layout, drag and drop, and reveal animations.
The Unlicense
244 stars 30 forks source link

CollectionView: Can't drag first item to the second place #86

Closed AmirImam closed 1 year ago

AmirImam commented 1 year ago

Hi I don't know if this is a bug or not, but I think it is a problem. I want to drag & drop items in a CollectionView. When I drag the first item and try to drop it on second place it doesn't work, and it makes the CollectionView scroll so fast. I don't know if this explanation is enough or not, but I attached an image that describes the situation Untitled

Note that the item in the second place doesn't move to let me drop the dragged item, and it suddenly keep scrolling My XAML:

 <sho:CollectionView x:Name="Collector"
                            ItemHeight="140" 
                            VerticalOptions="FillAndExpand"  
                            ItemSpacing="20"
                            EnableDragAndDrop="True" 
                            DragAndDropStartedCommand="{Binding DragStartedCommand}"
                            CurrentIndex="{Binding Order}"
                            ItemsSource="{Binding Collection}">
            <sho:CollectionView.ItemTemplate>
                <DataTemplate>
                    <sho:DraggableViewCell x:Name="DraggableViewCell">
                        <ContentView>
                            <StackLayout>

                            <StackLayout Orientation="Horizontal">
                                <Image Source="{Binding Thumbnail}" 
                                       Aspect="Fill" 
                                       WidthRequest="50" HeightRequest="50"
                                       VerticalOptions="Center"
                                       HorizontalOptions="Center"/>
                                <StackLayout>
                                    <Label Text="{Binding OrderIndex}" />
                                    <Label Text="{Binding Title}" FontSize="Large" TextColor="Black" />
                                    <Label Text="{Binding Description}" FontSize="Small" TextColor="Gray" />
                                </StackLayout>
                            </StackLayout>
                                <BoxView HeightRequest="1" BackgroundColor="Gray" />
                            </StackLayout>
                        </ContentView>
                    </sho:DraggableViewCell>
                </DataTemplate>
            </sho:CollectionView.ItemTemplate>
        </sho:CollectionView>