Search code examples
androidxamarinlayoutxamarin.formsscrollview

2 ScrollViews in xamarin forms


Layout design

I need to use two ScrollViews in the same page. This is an image showing how I want to design my application.

I was thinking about using a grid layout of 3 rows, but i don't know how I can implement 2 scrollViews inside the second row in A and B.


Solution

  • You are one the right way. you can use a grid-layout with 3 rows and 2 columns.

    <GridLayout>
        <Grid.RowDefinitions>
            <RowDefinition Height="20"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="20"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Frame x:Name="TOP"
               Grid.Row="0"
               Grid.Column="0"
               Grid.ColumnSpan="2">
             ...
        </Frame>
        <ScrollView x:Name="LeftView"
                    Grid.Row="1"
                    Grid.Column="0"
                    Orienation="Vertical">
             ...
        </ScrollView>
        <ScrollView x:Name="RightView"
                    Grid.Row="1"
                    Grid.Column="1"
                    Orienation="Vertical">
             ...
        </ScrollView>            
        <Frame x:Name="BOTTOM"
               Grid.Row="2"
               Grid.Column="0"
               Grid.ColumnSpan="2">
             ...
        </Frame>           
    </GridLayout>