Hi,
I use an SfListView with a TapCommand binding. The users taps on a listview item to open its details.
The user should be able to change the sort order of the listview by double tapping on the controls. For instance by double tapping on a displayed name, the ListView will be sorted by Name, double tapping on city, will change the sort order to City and so on.
My xaml looks like this
<syncfusion:SfListView x:Name="listView" ItemsSource="{Binding CustList}" ItemSpacing="3" TapCommand="{Binding CustomerTappedCommand}">
<syncfusion:SfListView.ItemTemplate>
<DataTemplate>
<Frame CornerRadius="10" OutlineColor="DarkGray" BackgroundColor="LightCyan" Padding="10" HasShadow="True">
<StackLayout Orientation="Horizontal" BackgroundColor="{Binding LineBackground}">
<Label x:Name="custName" Text="{Binding Name}" FontSize="Large">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding BindingContext.SortTappedCommand,Source={x:Reference Name=listView}}" CommandParameter="Name" NumberOfTapsRequired="2"/>
</Label.GestureRecognizers>
</Label>
</StackLayout>
</Frame>
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>
</syncfusion:SfListView>
This does not work as expected, because by double tapping on the Label "custName", not only the sort order is changed but also the item is opened. The TapCommand of the SfListView is also fired. I tried to set flags, in the SortTappedCommand, to skip opening the item when the CustomerTappedCommand is also fired, but this does also not work stable.
I tried also with the "ItemDoubleTap" event on the SfListView (with removed GestureRecognizers on the labels), but there I didn't find a way to find out which of the labels (there are multiple Labels in my code) has been double tapped. I need this to find out on which field the user wants to sort.
Regards
Thomas