Wednesday, 24 September 2014

Xamarin Android touch event handler return false

Sometimes we need to step into a touch event to ascertain something about the touch (typically its location) before other code responds to it.

When this is done we need to remember to sign off with 'e.Handled = false' so that the touch event isn't consumed and can be handled elsewhere. This is the equivalent of the java 'return false'.

      void _myView_Touch(object sender, View.TouchEventArgs e)
        {
            //do your stuff here

            e.Handled = false;

        }

No comments:

Post a Comment

Comments are moderated, so you'll have to wait a little bit before they appear!