Tapgesture
RafaelVieira2323 opened this issue · 1 comments
RafaelVieira2323 commented
Hi, I'm trying to insert a tagesture
into an image inside a carrouselview
. But tapgesture
is not recognized.
My xaml code:
<RelativeLayout HorizontalOptions="Center" HeightRequest="220" WidthRequest="330">
<controls:CarouselViewControl x:Name="Carrousel" Orientation="Horizontal" HorizontalOptions="Center" ItemsSource="{Binding Interventions}" HeightRequest="220" WidthRequest="330" Margin="0,16,0,0" ShowIndicators="True" IndicatorsTintColor="{StaticResource Unselected}" CurrentPageIndicatorTintColor="{StaticResource white}" >
<controls:CarouselViewControl.ItemTemplate>
<DataTemplate>
<StackLayout Orientation="Vertical" >
<Label Text="{Binding woundPhoto[0].createdAt}" TextColor="{StaticResource white}" FontAttributes="Bold" FontSize="12" HorizontalOptions="Center"/>
<RelativeLayout WidthRequest="220" HeightRequest="165" VerticalOptions="Center" HorizontalOptions="Center" >
<Image x:Name="Imagem" Source="{Binding woundPhoto[0].photoUri }" Aspect="AspectFill" WidthRequest="220" HeightRequest="165">
<Image.GestureRecognizers>
<TapGestureRecognizer BindingContext="{Binding Source={x:Reference Imagem}, Path=BindingContext}" Command="{Binding Command_ImageTapped}"/>
</Image.GestureRecognizers>
</Image>
<StackLayout WidthRequest="220" HeightRequest="165" Orientation="Horizontal" >
<Image x:Name="CameraImage" WidthRequest="22" HeightRequest="22" HorizontalOptions="EndAndExpand" VerticalOptions="StartAndExpand" Margin="0,8,0,0">
<Image.Source>
<OnPlatform x:TypeArguments="ImageSource">
<On Platform="Android" Value="ic_camera.xml"/>
<On Platform="iOS" Value="ic_camera.png"/>
</OnPlatform>
</Image.Source>
</Image>
<Label x:Name="Index" Text="{Binding woundPhoto.Count}" TextColor="{StaticResource white}" FontSize="14" FontFamily="{StaticResource RegularFontFamily} " VerticalOptions="StartAndExpand" HorizontalOptions="End" Margin="0,8,8,0"/>
</StackLayout>
</RelativeLayout>
</StackLayout>
</DataTemplate>
</controls:CarouselViewControl.ItemTemplate>
</controls:CarouselViewControl>
</RelativeLayout>
My backend:
public partial class Report : ContentPage, INotifyPropertyChanged
{
Classes.ClassConversation.ResultadoConversation conversations;
readonly ViewModels.ConnectionHub _viewModel;
Classes.Wound Wound;
Classes.Utente Utentes;
public DelegateCommand Command_ImageTapped => new DelegateCommand(OnTapped);
public Report (Classes.ClassConversation.ResultadoConversation conversation, Classes.ClassUser.Result user)
{
InitializeComponent ();
_viewModel = new ViewModels.ConnectionHub(conversation, user);
conversations = conversation;
}
async void OnTapped()
{
await Navigation.PushAsync(new ZoomImage(Wound.result.intervention[Carrousel.Position].woundPhoto));
}
}
What am I doing wrong?
alexrainman commented
TapGesture will be supported in the next release.