Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How to create an accordion in Xamarin.Forms ListView

$
0
0

How can I create an accordion in a ListView with data binding? I am creating this app with 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>

Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>