xamarin.forms中listview内网格的最后一行之后的空间不均匀

时间:2017-09-03 13:58:24

标签: c# xaml xamarin xamarin.android xamarin.forms

我在xamarin.forms工作。我正面临着非常愚蠢的问题,已经浪费了5个小时。这是设计问题。

<Grid x:Name="MaingrdForms">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <ListView Grid.Row="0" x:Name="lstLatestProducts" HasUnevenRows="True"
                          ItemAppearing="LstLoadmore"
                          IsPullToRefreshEnabled="true"
                          Refreshing="LstPulled"
                          CachingStrategy="RecycleElement">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                <ViewCell.View>
                                    <Grid Padding="10">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="2*"/>
                                            <ColumnDefinition Width="4*"/>
                                            <ColumnDefinition Width="0.5*"/>
                                        </Grid.ColumnDefinitions>
                                        <Image Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" HeightRequest="100" WidthRequest="100" 
                                               Source="{Binding ProductImg}" Margin="5" VerticalOptions="Center" HorizontalOptions="Center" />
                                        <Label Grid.Row="0" Grid.Column="1" Text="{Binding ProductName}" Style="{StaticResource LabelHeaderStyle}"/>
                                        <Label Grid.Row="1" Grid.Column="1" Text="{Binding ProductDesc}" Style="{StaticResource LabelDescStyle}"/>
                                        <StackLayout Grid.Row="2" Grid.Column="1" Orientation="Horizontal">
                                            <Image Source="icon_password.png"/>
                                            <Label Text="{Binding SubscriptionCategory}" VerticalOptions="Center" HorizontalOptions="Start"/>
                                            <Image Source="icon_password.png"/>
                                            <Label Text="{Binding CreatedDate}" VerticalOptions="Center" HorizontalOptions="Start"/>
                                        </StackLayout>
                                        <Image Grid.Row="0" Grid.Column="2" Grid.RowSpan="3" VerticalOptions="Start" Source="erecall.png"/>
                                    </Grid>
                                </ViewCell.View>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
                <Label Grid.Row="0" x:Name="lblNoRecordFound" Text="No Record found" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"/>
            </Grid>

在List中,我将HasUnevenRow = true设置为行高,但在每一行中,最后一行后面都有一些空格。那个空间的高度也不同。我无法弄清楚实际问题在哪里。

enter image description here

0 个答案:

没有答案