From 72af1a8a3a7039b99208f2964645e5dd96519ea3 Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Sat, 9 Dec 2017 22:46:27 -0800 Subject: [PATCH] Add double click recognizer --- Ooui.Forms/EventTracker.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Ooui.Forms/EventTracker.cs b/Ooui.Forms/EventTracker.cs index d9eb5b5..afa79f0 100644 --- a/Ooui.Forms/EventTracker.cs +++ b/Ooui.Forms/EventTracker.cs @@ -119,7 +119,7 @@ namespace Ooui.Forms var weakEventTracker = new WeakReference (this); var tapRecognizer = recognizer as TapGestureRecognizer; - if (tapRecognizer != null) { + if (tapRecognizer != null && tapRecognizer.NumberOfTapsRequired == 1) { var returnAction = new TargetEventHandler ((s, e) => { var tapGestureRecognizer = weakRecognizer.Target as TapGestureRecognizer; var eventTracker = weakEventTracker.Target as EventTracker; @@ -134,6 +134,21 @@ namespace Ooui.Forms }; return uiRecognizer; } + if (tapRecognizer != null && tapRecognizer.NumberOfTapsRequired == 2) { + var returnAction = new TargetEventHandler ((s, e) => { + var tapGestureRecognizer = weakRecognizer.Target as TapGestureRecognizer; + var eventTracker = weakEventTracker.Target as EventTracker; + var view = eventTracker?._renderer?.Element as View; + + if (tapGestureRecognizer != null && view != null) + tapGestureRecognizer.SendTapped (view); + }); + var uiRecognizer = new NativeGestureRecognizer { + EventType = "dblclick", + Handler = returnAction, + }; + return uiRecognizer; + } return null; }