Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 滚动没有发生_C#_Xamarin_Xamarin.forms - Fatal编程技术网

C# 滚动没有发生

C# 滚动没有发生,c#,xamarin,xamarin.forms,C#,Xamarin,Xamarin.forms,我正在使用Visual studio 2017处理一个Xamarin Forms项目。我需要使用滚动显示长文本,因此我实现了以下代码,但它不显示所有内容,它显示部分内容,也不滚动,仅显示标签高度内的文本。这不适用于Android和IOS。如果我删除HeightRequest=“350”它会滚动,但不会显示内容 <Grid BackgroundColor="#0B738C"> <Grid.ColumnDefinitions> <ColumnDe

我正在使用Visual studio 2017处理一个Xamarin Forms项目。我需要使用滚动显示长文本,因此我实现了以下代码,但它不显示所有内容,它显示部分内容,也不滚动,仅显示标签高度内的文本。这不适用于Android和IOS。如果我删除
HeightRequest=“350”
它会滚动,但不会显示内容

<Grid BackgroundColor="#0B738C">
    <Grid.ColumnDefinitions>
        <ColumnDefinition></ColumnDefinition>
    </Grid.ColumnDefinitions>

    <Grid.RowDefinitions>
        <RowDefinition Height="25"></RowDefinition>
        <!--bg-->
        <RowDefinition Height="20"></RowDefinition>
        <!--brand-->
        <RowDefinition Height="30"></RowDefinition>
        <!--Lable Agreement-->
        <RowDefinition Height="auto"></RowDefinition>
        <RowDefinition Height="40"></RowDefinition>
        <!--Text Agreement-->

        <!--checkox-->
        <RowDefinition Height="50"></RowDefinition>
        <!--I agree Button-->
        <RowDefinition Height="25"></RowDefinition>
    </Grid.RowDefinitions>

    <Image 
        Grid.Row="0" 
        Grid.Column="0" 
        Source="{local:ImageResource bg.jpg}" 
        Aspect="Fill" 
        Grid.ColumnSpan="1" Grid.RowSpan="12" x:Name="bgImage" />

    <Image 
        Grid.Row="1" 
        Grid.Column="0" 
        Source="{local:ImageResource brand.png}" 
        Aspect="Fill" 
        Scale="1.5"
        HorizontalOptions="Center"
        VerticalOptions="Center"
        Grid.ColumnSpan="1" Grid.RowSpan="1" x:Name="imageBrand" >
    </Image>

    <Label 
        x:Name="labelAgreement"
        IsVisible="True"
        Grid.Row="2" 
        Grid.Column="0" 
        Grid.RowSpan="2"
        HorizontalOptions="Center"
        Text="Software License and Agreement"
        TextColor="WhiteSmoke"
        FontFamily="Open Sans"
        Margin="10"
        FontSize="16" />

    <ScrollView Grid.Row="3" Grid.Column="0" >
        <StackLayout >
            <Label             
        x:Name="txtAgreement"
        HorizontalOptions="Center"
        VerticalOptions="Fill"
        HorizontalTextAlignment="Start"
        WidthRequest="300"
        HeightRequest="350"
        TextColor="Black"
        FontFamily="Open Sans"
        FontSize="10"
        FontAttributes="None"
        BackgroundColor="White"
        IsVisible="True"/>
        </StackLayout>
    </ScrollView>

    <Switch  

        x:Name="checkAgree"
        Scale="0.70"
        Grid.Row="4" Grid.Column="0" 
        Margin="15,0,10,5"
        HorizontalOptions="Start"
        Toggled="Handle_Toggled"></Switch>

    <Label      
        Grid.Row="4" Grid.Column="0" 
        HorizontalTextAlignment="Start"  
        VerticalTextAlignment="Center"
        HorizontalOptions="Start"
        TextColor="#FFFFFF"
        FontFamily="Open Sans"
        FontSize="14" 
        FontAttributes="Bold"
        Text="Agree to the above terms and conditions" 
        Margin="80,0,0,10"/>



    <Button 
        Margin="0,0,0,0"
        Grid.Row="5"
        Grid.Column="0"
        x:Name="buttonAgree"
        Text="Continue"
        HorizontalOptions="Center"
        VerticalOptions="CenterAndExpand"
        IsVisible="True"
        BackgroundColor="#1B9170"
        TextColor="#FFFFFF"
        FontFamily="Open Sans"
        FontSize="18"
        FontAttributes="Bold"
        WidthRequest="140"
        IsEnabled="False"
        Clicked="HandleAgree_Clicked"/>

    <Label 
        Grid.Row="5" 
        Grid.Column="0" 
        x:Name="labelError"
        Text=""
        Font="Large"
        HorizontalOptions="Center"
        VerticalOptions="CenterAndExpand"
        IsVisible="false"/>

</Grid>

您需要向ScrollView发出HeightRequest

    <ScrollView Grid.Row="3" Grid.Column="0" HeightRequest="250">
    <StackLayout >
        <Label             
    x:Name="txtAgreement"
    HorizontalOptions="Center"
    VerticalOptions="Fill"
    HorizontalTextAlignment="Start"
    WidthRequest="300"
    HeightRequest="350"
    TextColor="Black"
    FontFamily="Open Sans"
    FontSize="10"
    FontAttributes="None"
    BackgroundColor="White"
    IsVisible="True"/>
    </StackLayout>
</ScrollView>

xaml的其余部分(主要是容纳它的网格)是什么?我更新了这个问题