Je veux créer une fonctionnalité permettant de toucher et d'ajouter une image d'épingle sur une autre image d'arrière-plan et l'image d'arrière-plan doit être capable de zoomer et de faire un panoramique. Voici le code XAML pour cela, ici le zoom par pincement ne fonctionne pas mais l'événement de toucher fonctionne bien.
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:POC"
xmlns:ui="clr-namespace:Vapolia.Lib.Ui;assembly=XamarinFormsGesture"
x:Class="POC.MainPage"
Title="Main Page">
<ScrollView AbsoluteLayout.LayoutFlags="All">
<local:PinchAndPanContainer>
<local:PinchAndPanContainer.Content >
<AbsoluteLayout x:Name="AbsoluteLayoutForImage">
<Image x:Name="FloorPlanImage"
Source="Capture2.png"
HeightRequest="400"
IsEnabled="True"
InputTransparent="True"
ui:Gesture.TapCommand2="{Binding TapCommand2}"/>//This Property
</AbsoluteLayout>
</local:PinchAndPanContainer.Content>
</local:PinchAndPanContainer>
</ScrollView>
dans le fichier cs, cette commande de robinet ajoute une image d'épingle à l'intérieur de la disposition absolue en utilisant les coordonnées dans Point.
public Command<Point> TapCommand2 => new Command<Point>(point =>
{
AddPin(point);
});
Maintenant si on enlève juste ui:Gesture.TapCommand2="{Binding TapCommand2}"
cette propriété du code ci-dessus pinch et pan fonctionne bien.
Pour l'événement Tap, j'ai utilisé le paquet NuGet Vapolia.XamarinFormsGesture et pour le pinch et le pan, j'ai utilisé le Gesture Recognizer de xamarin forms. Quelqu'un peut-il m'aider ?