这是我的XAML源代码:
<ScrollView VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Margin="20,0,20,0">
<ListView x:Name="listViewm" ItemsSource="{Binding MySource}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid BackgroundColor="LightGray" Padding="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Label Grid.Column="0" Grid.Row="0" Text="{Binding x}" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="#E9EDF2" TextColor="Black" HorizontalTextAlignment="Center" Margin="1"></Label>
<Label Grid.Column="1" Grid.Row="0" Text="x" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="#E9EDF2" TextColor="Black" HorizontalTextAlignment="Center" Margin="1"></Label>
<Label Grid.Column="1" Grid.Row="1" Text="y" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="#E9EDF2" TextColor="Black" HorizontalTextAlignment="Center" Margin="1"></Label>
<Label Grid.Column="0" Grid.Row="1" Text="{Binding y}" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="#E9EDF2" TextColor="Black" HorizontalTextAlignment="Center" Margin="1"></Label>
<Label Grid.Column="1" Grid.Row="2" Text="z" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="#E9EDF2" TextColor="Black" HorizontalTextAlignment="Center" Margin="1"></Label>
<Label Grid.Column="0" Grid.Row="2" Text="{Binding z}" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="#E9EDF2" TextColor="Black" HorizontalTextAlignment="Center" Margin="1"></Label>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ScrollView>
我无法修复显示。这是运行时显示的列表。有解决方案吗?
enter image description here
谢谢
1条答案
按热度按时间0aydgbwb1#
您可以尝试设置HasUnevenRows属性:
有关详细信息,您可以参考ListView外观。
希望能成功。