Xamarin.Forms Long Press Effect - How to set the Command in Code Behind (NO XAML)

烂漫一生 提交于 2019-12-07 07:14:23

This documentation on Microsoft's website is very helpful in explaining how to set attached properties in code.

So according to the example, your code should look something like this:

image.Effects.Add(new LongPressedEffect());
LongPressedEffect.SetCommand(image, myCommand);

Where myCommand is an ICommand.

This should create the LongPressedEffect, add it to the image, and then set the attached ICommand that determines the behavior.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!