I want to bind the Command property of in image TapGestureRecognizer to a command in the viewModel of the view:
so I made this:
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="Vote_Tapped" Command="{Binding Path=BindingContext.OnVotingCommand, Source={x:Reference stkMain}}" CommandParameter="{Binding id}"/>
</Image.GestureRecognizers>
the stkMain is the container of the page,
but it doesn't work.
here's the ItemTemplate:
<syncfusion:SfListView.ItemTemplate>
<DataTemplate>
<AbsoluteLayout Margin="10" VerticalOptions="Start" HorizontalOptions="FillAndExpand" BackgroundColor="Orange">
<StackLayout VerticalOptions="Start" AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All">
<Image Source="{Binding image}" Aspect="Fill">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" CommandParameter="{Binding}"/>
</Image.GestureRecognizers>
</Image>
<BoxView HeightRequest="30" HorizontalOptions="FillAndExpand"/>
</StackLayout>
<Image Source="{Helper:ImageResourceExtension PrinseSultan.images.misc.like-line.png}" AbsoluteLayout.LayoutBounds="0.5,1,80,40" AbsoluteLayout.LayoutFlags="PositionProportional">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="Vote_Tapped" Command="{Binding Path=BindingContext.OnVotingCommand, Source={x:Reference stkMain}}" CommandParameter="{Binding id}"/>
</Image.GestureRecognizers>
</Image>
<!--<Button Text="Upvote" Command="{Binding Path=BindingContext.OnVotingCommand, Source={x:Reference stkMain}}" CommandParameter="{Binding id}" x:Name="btnVote" AbsoluteLayout.LayoutBounds="0.5,1,80,40" AbsoluteLayout.LayoutFlags="PositionProportional"/>-->
<!--<Image/>-->
</AbsoluteLayout>
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>