Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin Forms Listview in Scrollview doesn't scroll

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
         x:Class="Dh.ListPage">
<ContentPage.Content>
    <ScrollView>
        <StackLayout Style="{StaticResource MainStackLayoutWhenLoggedInStyle}">
            <Frame Style="{StaticResource FrameStyle2}">
                <StackLayout>
                    <Label Text="Vragenlijsten" Style="{StaticResource TitelLabelStyle}" />
                </StackLayout>
            </Frame>
            <Frame Style="{StaticResource FrameStyle2}">
                <StackLayout>
                    <Label Text="DRINGENDE VRAGEN: vul deze vragen meteen in!" Style="{StaticResource StandardLabelStyle}"/>
                    <Frame Style="{StaticResource FrameStyle2}">
                        <StackLayout Style="{StaticResource ListViewStackLayoutStyle}" >
                            <ListView ItemTapped="OnItemTapped" ItemsSource="{Binding Question_Lists}" Style="{StaticResource StandardListViewStyle}">
                                <ListView.ItemTemplate>
                                    <DataTemplate>
                                        <ViewCell>
                                            <ViewCell.View>
                                                <Label Text="{Binding Title}" Style="{StaticResource StandardLabelStyle}" />
                                            </ViewCell.View>
                                        </ViewCell>
                                    </DataTemplate>
                                </ListView.ItemTemplate>
                            </ListView>
                        </StackLayout>
                    </Frame>
                </StackLayout>
            </Frame>
        </StackLayout>
    </ScrollView>
</ContentPage.Content>

When my screen is too small then my listview does not want to scroll. If my screen is not too small then listview does scroll. Can someone help me pls?

like image 395
Ali Eren Avatar asked Mar 12 '23 08:03

Ali Eren


2 Answers

Never stack a ListView inside a ScrollView as both implement scrolling on Android at least.

like image 160
Malte Goetz Avatar answered Mar 27 '23 00:03

Malte Goetz


Xamarin.Forms.ScrollView Class documentation says:

Application developers should not nest one ScrollView within another. Additionally, they should refrain from nesting them other elements that can scroll, such as WebView.

ListView.ScrollTo Method Scrolls the ListView to the item.

like image 28
LCJ Avatar answered Mar 27 '23 01:03

LCJ