Вертикальный Scrollview не работает в формах xamarin.

user3452 спросил: 03 ноября 2018 в 08:18 в: image

Я пытаюсь прокрутить xfxCardview в формах Xamarin. Но это не прокрутка. Это мой код

            <ScrollView  Orientation = "Vertical" VerticalOptions="FillAndExpand">
                <StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand">
            <xfx:XfxCardView 
                    BackgroundColor="White"
                    CornerRadius="30" 
                Elevation="20"
             HeightRequest="160" IsClippedToBounds="True" VerticalOptions="FillAndExpand">
                <StackLayout Orientation="Horizontal">                    <Grid VerticalOptions="CenterAndExpand"  
             Padding="0"  
             HorizontalOptions="FillAndExpand"  
             BackgroundColor="Transparent">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="25" />
                            <RowDefinition Height="25" />
                            <RowDefinition Height="25" />
                            <RowDefinition Height="35" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="100"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Frame Margin="10,5,5,-20"  CornerRadius="10" Grid.RowSpan="3"  BackgroundColor="LightBlue"  IsClippedToBounds="True">
                            <Image Margin="-70,-70,-70,-70"  Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="restaurantimage1.jpg" />
                        </Frame>
                        <Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="4" Margin="0,10,0,0"  TextColor="Black" FontFamily="Bold,100"  Text="Premera restaurant" />
                        <Image Grid.Row="0" Grid.Column="5" Margin="0,10,0,0"  Source="whitehearticon3"/>
                        <Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="6" Text="Avenue Road, 256" TextColor="Blue" />
                        <Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="6" Text="Indian,Italy,Chinese Kitchen" />
                        <Image Grid.Row="3" Grid.Column="1"   Source="whitestaricon1"/>
                        <Label Grid.Row="3" Grid.Column="2" HeightRequest="30" Text="4,3" />
                        <Image Grid.Row="3" Grid.Column="3" Margin="-10,0,0,0"   Source="rupeeicon1"/>
                        <Label Grid.Row="3" Grid.Column="4"  Margin="-10,0,0,0" Text="150 min" />
                        <Image Grid.Row="3" Grid.Column="5" Margin="-20,0,0,0"  Source="handicon1"/>
                            <Label Grid.Row="3" Grid.Column="6"  Margin="-10,0,0,0" HeightRequest="10" Text="Free 3kms" />
                    </Grid>
                </StackLayout>
            </xfx:XfxCardView>                <xfx:XfxCardView 
                    BackgroundColor="White"
                    CornerRadius="30" 
                Elevation="20"
             HeightRequest="160" IsClippedToBounds="True" VerticalOptions="FillAndExpand">
                <StackLayout Orientation="Horizontal">                    <Grid VerticalOptions="CenterAndExpand"  
             Padding="0"  
             HorizontalOptions="FillAndExpand"  
             BackgroundColor="Transparent">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="35" />
                            <RowDefinition Height="25" />
                            <RowDefinition Height="25" />
                            <RowDefinition Height="35" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="100"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Frame Margin="10,5,5,-20"  CornerRadius="10" Grid.RowSpan="3"  BackgroundColor="LightBlue"  IsClippedToBounds="True">
                            <Image Margin="-70,-70,-70,-70"  Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="restaurantimage2.jpg" />
                        </Frame>
                        <Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="4" Margin="0,10,0,0"  TextColor="Black" FontFamily="Bold,100"  Text="Pesto restaurant" />
                        <Image Grid.Row="0" Grid.Column="5" Margin="0,10,0,0"   Source="whitehearticon3"/>
                        <Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="6"  Text="Bodhami Road, 6" TextColor="Blue"  />
                        <Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="6"  Text="Indian,Italy,Chinese Kitchen" />
                        <Image Grid.Row="3" Grid.Column="1"   Source="whitestaricon1"/>
                        <Label Grid.Row="3" Grid.Column="2" HeightRequest="30" Text="3,0" />                        <Label Grid.Row="3" Grid.Column="4"  Grid.ColumnSpan="3"  Text="No available" TextColor="Blue" />
                    </Grid>
                </StackLayout>
            </xfx:XfxCardView>
                    <Label Text="RESTAURANTS AWAY FROM YOU" TextColor="#595959" HeightRequest="30"></Label>
                    <Label  Text="25 Restaurants finded" TextColor="#d9d9d9" HeightRequest="20"></Label>
                    <xfx:XfxCardView 
                    BackgroundColor="White"
                    CornerRadius="30" 
                Elevation="20"
             HeightRequest="160" IsClippedToBounds="True" VerticalOptions="FillAndExpand">
                        <StackLayout Orientation="Horizontal">                            <Grid VerticalOptions="CenterAndExpand"  
             Padding="0"  
             HorizontalOptions="FillAndExpand"  
             BackgroundColor="Transparent">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="25" />
                                    <RowDefinition Height="25" />
                                    <RowDefinition Height="25" />
                                    <RowDefinition Height="35" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="100"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Frame Margin="10,5,5,-20"  CornerRadius="10" Grid.RowSpan="3"  BackgroundColor="LightBlue"  IsClippedToBounds="True">
                                    <Image Margin="-70,-70,-70,-70"  Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="restaurantimage3.jpg" />
                                </Frame>
                                <Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="4" Margin="0,10,0,0"  TextColor="Black" FontFamily="Bold,100"  Text="Hero" />
                                <Image Grid.Row="0" Grid.Column="5" Margin="0,10,0,0"  Source="whitehearticon3"/>
                                <Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="6" Text="Line street,2" TextColor="Blue" />
                                <Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="6" Text="Indian,Italy,Chinese Kitchen" />
                                <Image Grid.Row="3" Grid.Column="1"   Source="whitestaricon1"/>
                                <Label Grid.Row="3" Grid.Column="2" HeightRequest="30" Text="4,3" />
                                <Image Grid.Row="3" Grid.Column="3" Margin="-10,0,0,0"   Source="rupeeicon1"/>
                                <Label Grid.Row="3" Grid.Column="4"  Margin="-10,0,0,0" Text="150 min" />
                                <Image Grid.Row="3" Grid.Column="5" Margin="-20,0,0,0"  Source="handicon1"/>
                                <Label Grid.Row="3" Grid.Column="6"  Margin="-10,0,0,0" HeightRequest="10" Text="Free 3kms" />
                            </Grid>
                        </StackLayout>
                    </xfx:XfxCardView>                </StackLayout>
            </ScrollView>

Я не знаю, что не так с моим кодом, я устанавливаю ориентацию как вертикальную, а я устанавливаю VerticalOptions как заливку и расширение. Будет ли работать представление прокрутки или я должен поместить XfxCardview в Listview. Вот так выглядит мой текущий пользовательский интерфейс

и UI.

0 ответов