Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tapgesture #564

Open
RafaelVieira2323 opened this issue Feb 21, 2020 · 1 comment
Open

Tapgesture #564

RafaelVieira2323 opened this issue Feb 21, 2020 · 1 comment

Comments

@RafaelVieira2323
Copy link

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
Copy link
Owner

TapGesture will be supported in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants