【发布时间】:2018-11-14 15:30:33
【问题描述】:
我正在使用这个解决方案来处理长按事件:https://alexdunn.org/2017/12/27/xamarin-tip-xamarin-forms-long-press-effect/
当我使用 XAML 时它工作得很好,但我只需要使用后面的代码。如何将此命令添加到后面代码中的Image?
这是创建我的图像的代码:
var image = new Image
{
ClassId = item.Path,
Aspect = Aspect.AspectFill,
Source = item.ThumbNailImage,
Rotation = 90,
Margin = 10,
GestureRecognizers = { _tgr },
//Command here, but how?
};
【问题讨论】:
-
根据docs.microsoft.com/de-de/xamarin/xamarin-forms/app-fundamentals/…
image.Effects.Add(...) -
"无法从 'Xamarin.Forms.Command' 转换为 'Xamarin.Forms.Effect'"
-
_tgr是什么,您应该将所有代码都放在原始帖子中,并写下您到目前为止尝试过的内容。为什么要尝试将效果添加为命令? -
我想单击以选择图片并长按以显示图片详细信息,例如文件大小等...
标签: c# xamarin.forms command long-press