您能否让我知道如何识别Xamarin Forms应用程序中的长按手势?如何在Xamarin Forms中长按手势?
几天我用TapGestureRecognizer
TapGestureRecognizer imageTap = new TapGestureRecognizer();
imageTap.Tapped += (sender, args) => this.OnClickImage;
image.GestureRecognizers.Add(imageTap);
但我不知道如何根据本thread from xamarin forum
它应该看起来像这样使长按压姿势,但它不工作之前。
var dumpParam = new RelayGesture((g, x) => DisplayAlert("Title", "Hello message", "Cancel"));
book.Cover.SetValue(Gestures.InterestsProperty, new GestureCollection() {
new GestureInterest
{
GestureType = GestureType.LongPress
GestureCommand = // what should I set?
GestureParameter = dumpParam
}
});
如何设置我的自定义处理程序方法?
你可以看看这个https://forums.xamarin.com/discussion/27323/how-can-i-recognize-long-press-gesture-in- xamarin-forms –
@NoorAShuvo是的。但我不知道在我的情况下实施它。我不使用'XAML'。在我用'Xamarin.Froms.Image'使用'TapGestureRecognizer'和'Tapped'事件前几天,我将它添加到'GestureRecognizers'图像,但我不知道如何设置我的句柄方法到'GestureInterest',它描述为上面的链接。你能提供一个例子吗? –