如何在带有数据绑定的ListView
中创建手风琴?我正在用Xamarin.Forms
创建这个应用程序。
这是我到目前为止:
<ListView x:Name="List" HasUnevenRows="True" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<Grid Padding="10,10,10,10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="ABC:-" FontSize="20" TextColor="Black" Grid.Column="0" Grid.Row ="0"/>
<Label Text="{Binding ABC}" FontSize="20" TextColor="Black" Grid.Column="1" Grid.Row ="0" HorizontalOptions="EndAndExpand" VerticalOptions="FillAndExpand"/>
<Label Text="XYZ:-" FontSize="20" TextColor="Black" Grid.Column="0" Grid.Row ="1"/>
<Label Text="{Binding XYZ}" FontSize="20" TextColor="Black" Grid.Column="1" Grid.Row ="1" HorizontalOptions="EndAndExpand" VerticalOptions="FillAndExpand"/>
</Grid>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
您可能需要查看下面的主题,其中列出了一些选项。我们的手风琴视图不在ListView
内,但我们基本上只使用WidthRequest
和一个小动画来使各种WebView
s扩展和崩溃。