예제 #1
0
	void Start () {
		dragRecognizer = GetComponent<DragRecognizer>();
		tapRecognizer = GetComponent<TapRecognizer>();
		
		dragRecognizer.OnGesture += OnDragGesture;
		tapRecognizer.OnGesture += OnTapGesture;
	}
예제 #2
0
        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;
        }