Xamarin.forms: [Bug] ListView scroll not working when is inside a ScrollView

Created on 30 Aug 2019  路  11Comments  路  Source: xamarin/Xamarin.Forms

Description

ListView scroll isn't working when is inside 脿 ScrollView on new version of Xamarin.Forms, but was working before update.

Steps to Reproduce

  1. Create a new Project
  2. Add at MainPage 脿 ScrollView
  3. Inside ScrollView, add a StackLayout
  4. Add to StackLayout a ListView.

Expected Behavior

Be possible scroll by the ScrollView and ListView

Actual Behavior

Only is possible scroll on ScrollView, the ListView scroll be fronzen.

Basic Information

  • Version with issue:
  • Last known good version: 4.2.0.673161-pre3
  • IDE: Visual Studio 2019
  • Platform Target Frameworks:

    • Android: 8.1

  • Nuget Packages: Xamarin.Forms
  • Affected Devices: Emulator, Moto G4

Reproduction Link

<ScrollView>
        <StackLayout>
            <Label Text="Welcome to Xamarin.Forms!" 
                   HorizontalOptions="Center"
                   VerticalOptions="CenterAndExpand" />
            <ListView ItemsSource="{Binding Buttons}">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <Button Text="{Binding}"/>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackLayout>

    </ScrollView>
listview 2 regression Android bug

All 11 comments

@aismaniotto Can you please attach a small project that demonstrates this issue? Thanks!

I believe that the snippet code is enough to reproduce, but I created a small project on my github.

https://github.com/aismaniotto/NestedScrollView.

Hope be enough.

Thanks for the attention.

@aismaniotto Thank you for the repro. I don't see a ScrollView in your page. I assumed that the first StackLayout is meant to be a ScrollView.

Can you please list the steps to reproduce the issue? What version of Xamarin.Forms was this previously working in?

Thanks!

So sorry. I guess I modify to do some tests and forget to roll back before upload to Github. This night I will update and let you know. I don't remenber how it's now, but should be like the snippet code.

@samhouts It's updated!

Caused by https://github.com/xamarin/Xamarin.Forms/pull/7032/files#diff-ef4e030a3614a0c4819c7bffc5fd7b03R114 #7032

@aismaniotto So, this was technically working, but it was unintentionally working. It is still not recommended to put a ListView inside of a ScrollView. It is unpredictable. Please see https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/listview/performance#improving-listview-performance for more information.

@aismaniotto So, this was technically working, but it was unintentionally working. It is still not recommended to put a ListView inside of a ScrollView. It is unpredictable. Please see https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/listview/performance#improving-listview-performance for more information.

The information under that link does not specify the platform. In iOS app a ListView placed inside a ScrollView with Horizontal Orientation scrolls vertically with no issues under 4.2. So did Xamarin.Android ListView prior to 4.2. I did not run into any issues predictable or unpredictable. It might depend on content. I had no problems with multi-column ListView with text cells only. It is quite possible there could be issues with more complex content. That is hardly a reason to kill functionality that worked with no issues. A multi-column ListView wider than available screen is unusable. An alternative could be a grid, but grid is slow to load compared to ListView. It is a pity the issue is dismissed.

I guess that the issue wasn't dismiss. Even because someone also did a pull request to solve this issue, also that already is merged.
Actually I'm confident that in the next version I will not have this problem anymore...

I thought #7413 'closed' means the end of it. I have multi-column ListView inside ScrollView with ScrollOrientation.Horizontal in two published apps.
The Xamarin.Forms build 4.2.0.778463 made available yesterday still has the issue.
I was somewhat upset by the reference to 'Improving ListView performance': ListView will not receive any gestures, as they will be handled by the parent ScrollView'. If the parent ScrollView implements Horizontal Scroll only why should it block the Vertical Scroll of the nested ListView? I hope this is fixed soon. Until then I have to use Xamarin.Forms 4.1

The issue 7413 was duplicated, that's is why is closed.
The PR 7461 fix this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JasonLooney picture JasonLooney  路  55Comments

hartez picture hartez  路  55Comments

allessandrosj picture allessandrosj  路  61Comments

Giorgi picture Giorgi  路  99Comments

dannythomas13 picture dannythomas13  路  56Comments