【发布时间】:2018-09-20 07:39:11
【问题描述】:
我想创建一个功能来点击并在另一个背景图像上添加一个图钉图像,并且背景图像应该能够缩放和平移这是 XAML 代码,这里捏缩放不起作用但点击事件是工作正常
<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>
在cs文件中,这个tap命令使用Point中的坐标在绝对布局内添加一个pin图像。
public Command<Point> TapCommand2 => new Command<Point>(point =>
{
AddPin(point);
});
现在,如果我们从上面的代码中删除 ui:Gesture.TapCommand2="{Binding TapCommand2}" 这个属性,那么捏和平移就可以正常工作了。
对于 Tap 事件,我使用了 Vapolia.XamarinFormsGesture NuGet 包,对于捏和平移,我使用了 xamarin 表单手势识别器 谁能帮忙
【问题讨论】:
-
您好 Siddhant,欢迎来到 StackOverflow,只是想确定您是否尝试在这里实现图像缩放功能?
-
支持图像缩放和平移功能
-
使用它并尝试添加指向它的指针,看看它是否有效,以防它让我知道,我会更新我的答案
标签: xamarin xamarin.forms