void Start () { dragRecognizer = GetComponent<DragRecognizer>(); tapRecognizer = GetComponent<TapRecognizer>(); dragRecognizer.OnGesture += OnDragGesture; tapRecognizer.OnGesture += OnTapGesture; }
protected internal virtual void NativeInit() { this.NativeVisibility = this.Visibility; if (this.tapGestureRecognizer != null && this.NativeUIElement.GestureRecognizers != null && this.NativeUIElement.GestureRecognizers.Contains(this.tapGestureRecognizer)) { return; } WeakReference wr = new WeakReference(this); this.tapGestureRecognizer = new TapRecognizer(() => { if (wr.IsAlive) { ((UIElement)wr.Target).RaiseTap(); } }, this.NativeUIElement); this.tapGestureRecognizer.CancelsTouchesInView = false; this.NativeUIElement.AddGestureRecognizer(this.tapGestureRecognizer); this.NativeUIElement.UserInteractionEnabled = true; }