Hi,
has the feature been rolled out? Cause I'm experiencing the same sort of issue when SfListView is Horizontal. I have an image with tap gesture recognizer attached, when I tap the both events are fired, this is not the expected behavior. Is there any workaround?
Regards.
<sync:SfListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
</Grid.GestureRecognizers>
<Grid RowSpacing="0" HorizontalOptions="Fill" VerticalOptions="Fill">
<Image Source="{Binding PizzaImage}" HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="ImageRecognizer_Tapped"/>
</Image.GestureRecognizers>
</Image>
<Label Grid.Row="1" Text="{Binding PizzaName}"
LineBreakMode="WordWrap" HorizontalTextAlignment="Center"
VerticalTextAlignment="Center" TextColor="#8f0100"
FontAttributes="Bold"/>
</Grid>
</Grid>
</DataTemplate>
</sync:SfListView.ItemTemplate> |
private void ListView_ItemTapped(object sender, ItemTappedEventArgs e)
{
if (Device.OS == TargetPlatform.Android)
e.Handled = true;
}
private void TapGestureRecognizer_Tapped(object sender, EventArgs e)
{
//Perform action for tapped item
}
private void ImageRecognizer_Tapped(object sender, EventArgs e)
{
//Perform action for image
} |
If I use the grids GestureRecognizer , how am I supposed to get the itemdata of the tapped item?
<sync:SfListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
</Grid.GestureRecognizers>
<Grid RowSpacing="0" HorizontalOptions="Fill" VerticalOptions="Fill">
<Image Source="{Binding PizzaImage}" HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
</Image>
<Label Grid.Row="1" Text="{Binding PizzaName}"
LineBreakMode="WordWrap" HorizontalTextAlignment="Center"
VerticalTextAlignment="Center" TextColor="#8f0100"
FontAttributes="Bold"/>
</Grid>
</Grid>
</DataTemplate>
</sync:SfListView.ItemTemplate> |
private void TapGestureRecognizer_Tapped(object sender, EventArgs e)
{
var grid = sender as Grid;
var pizzaInfo = grid.BindingContext as PizzaInfo;
App.Current.MainPage.DisplayAlert("GridData", "The name of the pizza is " + pizzaInfo.PizzaName, "Ok");
} |