[英]How to create an accordion in Xamarin.Forms ListView
How can I create an accordion in a ListView
with data binding?如何在具有数据绑定的
ListView
中创建手风琴? I am creating this app with Xamarin.Forms
.我正在使用
Xamarin.Forms
创建这个应用程序。
This is what I have so far:这是我到目前为止所拥有的:
<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>
You may want to check out the thread below which lists a few options for this.您可能想查看下面的线程,其中列出了一些选项。 Our accordion view was not within a
ListView
but we basically just used WidthRequest
and a little animation to make various WebView
s expand and collapse.我们的手风琴视图不在
ListView
,但我们基本上只是使用WidthRequest
和一点动画来使各种WebView
展开和折叠。
https://forums.xamarin.com/discussion/33975/how-to-implement-expandable-collapsible-listview-in-xamarin-forms https://forums.xamarin.com/discussion/33975/how-to-implement-expandable-collapsible-listview-in-xamarin-forms
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.