Forum Xamarin.iOS

Xamarin Forms Scroll View Not Working

TimHawkinsTimHawkins USMember ✭✭
edited October 2017 in Xamarin.iOS

I am trying to add a ScrollView to a StackLayout which contains many rows of absolutely positioned labels. However upon adding the absolute Layout the Height becomes condensed and the ScrollView is not enabled. I have tried making the AbsoluteLayoutFlags PositionProportional but the results disappear from the screen and I have difficulty locating them using Xamarin forms previewer.

    <Grid x:Name="InstructionsPanel" HorizontalOptions="FillAndExpand"
    VerticalOptions="FillAndExpand"
    RowSpacing="0"
    ColumnSpacing="0"
    AbsoluteLayout.LayoutBounds="0, 0.7, 1, 0.55"
    AbsoluteLayout.LayoutFlags="All">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="20" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="20" />
        </Grid.ColumnDefinitions>
        <ScrollView Grid.Row="0" Grid.Column="1">

            <StackLayout Spacing="0" Orientation="Vertical">
                <ScrollView Orientation="Vertical" VerticalOptions="StartAndExpand">
                    <StackLayout Spacing="0" Padding="0,0,0,5" x:Name="RPanel" Orientation="Vertical" HeightRequest="80">
                        <Label Text="Test Header" Style="{StaticResource headerRowStyle}"  />
                        <!--x, y, width, height-->
                        <AbsoluteLayout HeightRequest="20" HorizontalOptions="FillAndExpand">
                            <Label Text="Head 1" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0, 0,0.13,1" />
                            <Label Text="Head 2"  AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0.16,0,0.08,1" />
                            <Label Text="Head 3" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0.26,0,.07,1"/>
                            <Label Text="Head 4" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0.39,0,.15,1"/>
                            <Label Text="Head 5" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0.59,0,.15,1"/>
                            <Label Text="Head 6" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0.80,0,.16,1"/>
                            <Label Text="Head 7" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="1,0,.15,1"/>
                        </AbsoluteLayout>
                        <!--This is test data to simulate what results-->
                        <AbsoluteLayout HeightRequest="20" HorizontalOptions="FillAndExpand" BackgroundColor="{StaticResource LightGrey}">
                            <Label Text="Test" AbsoluteLayout.LayoutFlags="All"        AbsoluteLayout.LayoutBounds="0, 0,0.13,1" />
                            <Label Text="1" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0.16,0,0.08,1" />
                            <Label Text="OF" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0.26,0,.07,1"/>
                            <Label Text="19.1" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0.39,0,.15,1"/>
                            <Label Text="Test"  AbsoluteLayout.LayoutFlags="All"  AbsoluteLayout.LayoutBounds="0.59,0,.15,1"/>
                            <Label Text="10.356" AbsoluteLayout.LayoutFlags="All"  AbsoluteLayout.LayoutBounds="0.80,0,.16,1"/>
                            <Label Text="Test" AbsoluteLayout.LayoutFlags="All"AbsoluteLayout.LayoutBounds="1,0,.15,1"/>
                        </AbsoluteLayout>
                    </StackLayout>
                </ScrollView>

//REST OF END TAGS HERE

Best Answer

  • TimHawkinsTimHawkins USMember ✭✭
    edited October 2017 Accepted Answer

    I solved this by setting the HeightRequest and the Orientation properties of the Scroll View

Answers

  • TimHawkinsTimHawkins USMember ✭✭
    edited October 2017 Accepted Answer

    I solved this by setting the HeightRequest and the Orientation properties of the Scroll View

Sign In or Register to comment.