ListView GroupHeader项未设置固定高度如何在xamarin表单中更改Groupheader项值

c6ubokkw  于 2022-12-07  发布在  其他
关注(0)|答案(1)|浏览(122)

下面的代码在Android中运行良好,但在iOS中却无法正常运行。问题是,高度似乎是此解决方案的替代方案。提前感谢。

<ListView.GroupHeaderTemplate>
                    <DataTemplate>
                        <ViewCell>
                                <Grid BackgroundColor="White" ColumnSpacing="5">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                       
                                    </Grid.ColumnDefinitions>

                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>

                                    <Label Text="{Binding Key.OperationId}" IsVisible="false"/>
                                    <Image Source="{Binding Key.ImageUrl}" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" WidthRequest="50"  HeightRequest="50" VerticalOptions="StartAndExpand" HorizontalOptions="StartAndExpand" />
                                    <Label Text="{Binding Key.Description}" Grid.Row="0" Grid.Column="1" FontAttributes="Bold" TextColor="Black" 
                                            VerticalOptions="StartAndExpand" HorizontalOptions="StartAndExpand" FontSize="15" />
                                    <Label Text="{Binding Key.Code}" Grid.Row="1" Grid.Column="1" TextColor="Black" VerticalOptions="StartAndExpand" HorizontalOptions="StartAndExpand" FontSize="15" />
                                </Grid>
                        </ViewCell>
                    </DataTemplate>
                </ListView.GroupHeaderTemplate>
bjg7j2ky

bjg7j2ky1#

正在此线程上跟踪此潜在问题:https://github.com/xamarin/Xamarin.Forms/issues/3769
评论中有一个要点建议创建一个custom renderer来修复iOS中ListView GroupHeader的大小:https://gist.github.com/nbevans/a713dc9c77a8f530b6f4f3cd4fad83c2
Reference link中的一个。

相关问题