DynamicWrapLayout icon indicating copy to clipboard operation
DynamicWrapLayout copied to clipboard

How to check index when tapped Item

Open Wenfengcheng opened this issue 6 years ago • 1 comments

When I add gestures to DataTemplate, how to check index of SelectedItem?

<StackLayout WidthRequest="90" HeightRequest="90">
                                <StackLayout.GestureRecognizers>
                                    <TapGestureRecognizer Command="{Binding ToCommand}"/>
                                </StackLayout.GestureRecognizers>
                                <Image Source="{Binding ImageSource}" Margin="0,15,0,0" HorizontalOptions="Center"/>
                                <Label Text="{Binding RelatedName}" HorizontalOptions="Center" Margin="0,8,0,10" FontSize="12" TextColor="#1e1e1e"/>
                            </StackLayout>

When the next version will update? I'm waiting for the ItemSelected event!

Wenfengcheng avatar Mar 15 '18 03:03 Wenfengcheng

Your best bet is to get the BindingContext of the tapped item and then check for its index in your ItemsSource List using List.IndexOf.

As for coming updates, I have some other projects I have to catch up on and haven't needed an update on these controls personally. However I am always accepting community contributions to make these layouts even better!

SuavePirate avatar Mar 15 '18 03:03 SuavePirate