4
<?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?

3 Answers 3

6

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

Sign up to request clarification or add additional context in comments.

3 Comments

How can i make my screen scrollable when my screen is too small ?
There are different options, for example you could use the ScrollView in a StackLayout and then set the content above/below as the ListView's header/footer.
It's so stupid that XF doesn't provide an ItemsControl alternative.
1

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.

Comments

0

Put your StackLayout in ListView.Header or ListView.Footer

<ListView ItemsSource="{Binding Comments}">
    <ListView.Header>
        <StackLayout Padding="30,30,30,0">
            <Label Text="Article" />
        </StackLayout>
    </ListView.Header>
    <ListView.Footer>
        <StackLayout HeightRequest="85" />
    </ListView.Footer>
</ListView>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.