Forum Xamarin.Forms

ListView click Event

I have a listview with multiple elements, in code # how do I see which one was clicked?

C#:

public HomePage()
{
InitializeComponent();
ListViewCategory.ItemsSource = CategoryList;

    }

private async void ClickCategoryDetail(object sender, EventArgs e)
{
await Navigation.PushAsync(new ricercaArticolo());
}

XAML:


<customControl:RepeaterView.ItemTemplate>



<pancakeView:PancakeView

                                        Margin="5"
                                        Padding="0"
                                        BackgroundColor="White"
                                        CornerRadius="30"
                                        Elevation="1"
                                        HasShadow="False"
                                        HeightRequest="60"
                                        WidthRequest="60">

                                        <pancakeView:PancakeView.GestureRecognizers>
                                            <TapGestureRecognizer Tapped="ClickCategoryDetail"></TapGestureRecognizer>
                                        </pancakeView:PancakeView.GestureRecognizers>
                                        <customControl:IconView
                                            Margin="10"
                                            BackgroundColor="White"
                                            Foreground="{StaticResource MainColor}"
                                            HeightRequest="35"
                                            HorizontalOptions="FillAndExpand"
                                            Source="{Binding Image}"
                                            WidthRequest="35" />
                                    </pancakeView:PancakeView>
                                    <Label
                                        x:Name="lblCategory"
                                        FontSize="12"
                                        HorizontalOptions="CenterAndExpand"
                                        HorizontalTextAlignment="Center"
                                        Style="{StaticResource LabelStyle}"
                                        Text="{Binding CategoryName}"
                                        TextColor="#2E2E2E"
                                        VerticalTextAlignment="Center"/> 
Sign In or Register to comment.