Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to expand and collapse the list by clicking the group header template?

$
0
0

Im created a grouped list view,

inside the grouped header template added stacklayout with tap gesture recogniser for tap command

<ListView x:Name="Groupedlist"  SeparatorVisibility="None" HasUnevenRows="True" " IsGroupingEnabled="True" >
                <ListView.GroupHeaderTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout >
                                  <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" Margin="20,0,20,0">
                                    <StackLayout.GestureRecognizers>
                                        <TapGestureRecognizer Command="{Binding some}" CommandParameter="khjhjih"/>
                                     <TapGestureRecognizer Tapped="parentTapped" Command="{Binding Source={x:Reference }}" CommandParameter="{Binding Groupedlist}"/>
                                    </StackLayout.GestureRecognizers>-->
                                    <Label Text="{Binding Type}" HorizontalOptions="StartAndExpand" VerticalOptions="Center"/>
                                     </Label>
                                    <Image Source="{Binding Label}" HeightRequest="24" WidthRequest="15" HorizontalOptions="End"/>
                                </StackLayout>
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.GroupHeaderTemplate>

but when i clicked that stack layout app get crashed.?

in cs
private void parentTapped(object sender, EventArgs e)
{
var selectedIndex = expandedGroups.IndexOf(((parent)((StackLayout)sender).GestureRecognizers));
}
don't know how to get the selected index by tapping the stacklayout.?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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