Xamarin Forms 按钮按下事件 3 秒执行操作或什么都不执行

Xamarin Forms Button pressed event for 3 seconds executes action or nothing

我需要在按钮后面写一个事件,当我按下它 3 秒时,必须执行一个方法。如果我在 3 秒之前释放它,它不会做任何事情。

有什么想法吗?

谢谢!

自 Xamarin Forms 2.4 起,按钮已包含 PressedReleased 事件。

Pressed 事件中启动 3 秒计时器。如果尚未触发,请在 Released 事件中将其取消。