コード例 #1
0
		protected override void OnElementChanged (ElementChangedEventArgs<Page> e)
		{
			base.OnElementChanged (e);
		
			_page = (e.NewElement) as GesturedContentPage;
			_gestureDetector = new GestureDetector (new InternalGestureCapture (_page));
		}
コード例 #2
0
		protected override void OnElementChanged (VisualElementChangedEventArgs e)
		{
			base.OnElementChanged (e);

			_page = (GesturedContentPage)e.NewElement;

			// Subscribe to the events here
			if (_page.CaptureSwipeRightToLeft) {
				NativeView.AddGestureRecognizer (new UISwipeGestureRecognizer (g => {
					_page.OnSwipeRightToLeft();
				}) { Direction = UISwipeGestureRecognizerDirection.Left });
			}

			if (_page.CaptureSwipeLeftToRight) {
				NativeView.AddGestureRecognizer (new UISwipeGestureRecognizer (g => {
					_page.OnSwipeLeftToRight();
				}) { Direction = UISwipeGestureRecognizerDirection.Right });
			}

			if (_page.CaptureSwipeBottomToTop) {
				NativeView.AddGestureRecognizer (new UISwipeGestureRecognizer (g => {
					_page.OnSwipeBottomToTop();
				}) { Direction = UISwipeGestureRecognizerDirection.Up });
			}

			if (_page.CaptureSwipeTopToBottom) {
				NativeView.AddGestureRecognizer (new UISwipeGestureRecognizer (g => {
					_page.OnSwipeTopToBottom();
				}) { Direction = UISwipeGestureRecognizerDirection.Down });
			}

			if (_page.CaptureTap) {
				NativeView.AddGestureRecognizer (new UITapGestureRecognizer (g => {
					_page.OnTap();
				}) { NumberOfTapsRequired = 1 });
			}

			if (_page.CaptureLongTap)
			{
				NativeView.AddGestureRecognizer (new UILongPressGestureRecognizer (g => {
					_page.OnLongTap();
				}));
			}
		}
コード例 #3
0
			public InternalGestureCapture(GesturedContentPage page)
			{
				_page = page;
			}