void AddSomeGesturesUsingCode ()
		{
			//2 options: 
			//1. use the standard xamarin api. e.g. view.GestureRecgonizers.Add(yourgesturerecognizer)
			//    and then call view.ProcessGestures();
			//    this has the benefit that when Xamarin add an api hook we can remove the view.ProcessGestures call and
			//    it will all be good.
			//2. use the extension method view.AddGestureRecognizer(yourgesturerecognizer)
			//    this is easier to use; and does everything under the hood; but it's a bit more obtrusive.
			//   in all cases, until Xamarin do more to open up the api, you must use the view extension method 
			//   removeGestureRecognizer
			// comment on https://bugzilla.xamarin.com/show_bug.cgi?id=30467 to get Xamarin to expand
			// IGestureRecognizer with some add/remove hooks
			var tapRecognizer = new TwinTechs.Gestures.LongPressGestureRecognizer ();
			tapRecognizer.OnAction += OnAction;
			Box2.AddGestureRecognizer (tapRecognizer);

			var tapRecognizerWith2Tocuhes = new TwinTechs.Gestures.LongPressGestureRecognizer ();
			tapRecognizerWith2Tocuhes.OnAction += OnAction;
//			tapRecognizerWith2Tocuhes.NumberOfTouchesRequired = 2;
			Label2.GestureRecognizers.Add (tapRecognizerWith2Tocuhes);
			Label2.ProcessGestureRecognizers ();


		}
Exemplo n.º 2
0
        void AddSomeGesturesUsingCode()
        {
            //2 options:
            //1. use the standard xamarin api. e.g. view.GestureRecgonizers.Add(yourgesturerecognizer)
            //    and then call view.ProcessGestures();
            //    this has the benefit that when Xamarin add an api hook we can remove the view.ProcessGestures call and
            //    it will all be good.
            //2. use the extension method view.AddGestureRecognizer(yourgesturerecognizer)
            //    this is easier to use; and does everything under the hood; but it's a bit more obtrusive.
            //   in all cases, until Xamarin do more to open up the api, you must use the view extension method
            //   removeGestureRecognizer
            // comment on https://bugzilla.xamarin.com/show_bug.cgi?id=30467 to get Xamarin to expand
            // IGestureRecognizer with some add/remove hooks
            var tapRecognizer = new TwinTechs.Gestures.LongPressGestureRecognizer();

            tapRecognizer.OnAction += OnAction;
            Box2.AddGestureRecognizer(tapRecognizer);

            var tapRecognizerWith2Tocuhes = new TwinTechs.Gestures.LongPressGestureRecognizer();

            tapRecognizerWith2Tocuhes.OnAction += OnAction;
//			tapRecognizerWith2Tocuhes.NumberOfTouchesRequired = 2;
            Label2.GestureRecognizers.Add(tapRecognizerWith2Tocuhes);
            Label2.ProcessGestureRecognizers();
        }