【问题标题】:How to create an accordion in Xamarin.Forms ListView如何在 Xamarin.Forms ListView 中创建手风琴
【发布时间】:2015-09-12 03:02:05
【问题描述】:

如何使用数据绑定在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>

【问题讨论】:

  • 改进的格式。
  • 您已经解决了这个问题吗?如果不是,您想要展开和折叠哪些元素?您是否希望每个ViewCell 能够展开和折叠,或者ViewCell 中的每个GridGrid 中的每个Label
  • @hvaughan3 视单元内的每个网格

标签: c# listview accordion xamarin.forms


【解决方案1】:

您可能想查看下面列出了一些选项的线程。我们的手风琴视图不在ListView 内,但我们基本上只是使用WidthRequest 和一个小动画来使各种WebViews 展开和折叠。

https://forums.xamarin.com/discussion/33975/how-to-implement-expandable-collapsible-listview-in-xamarin-forms

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-22
    • 2018-06-17
    相关资源
    最近更新 更多