Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

Low-level touch events label:enhancement #33

@MappingSteve

Description

@MappingSteve

Xamarin has never had adequate touch support.
When we [MappingIndustries / LiveCaddie] switched from native (java) to Xamarin development, we developed our own common API and implemented it on iOS and Android.

Now switching from Xamarin.Android + Xamarin.iOS to Xamarin.Forms, I find that we are gradually adding classes like "TouchButton", which is Button + native renderer that maps (on Android) OnTouchEvent(Android.Views.MotionEvent e) and OnInterceptTouchEvent to methods in code behind.

Attached properties look like a great way to do this, and support a broader range of controls without the repetition that I am doing right now.

I posted some preliminary cross-platform code in a Xamarin forum a couple of years ago. Eventually would like to contribute a better solution, and this seems like a good project + technique to add to.

Realistically, I won't be able to collaborate in the next few months, but if I had experience implementing attached properties I might start to migrate the code we have into that format.

Mentioning this in case other people have interest in this topic, and to see whether you think this is a good fit with xfgloss.

Edit I just saw https://michaelridland.com/xamarin/xaml-attached-properties-tricks-in-xamarin-forms/ which shows how easy it is to attach a gesture via attached property, so that might get me started on attaching a cross-platform representation of Android OnTouchEvent.

EDIT 2 For my company, most of our advanced touch needs seem to be met by making a "TouchAwareContentView" which implements our ITouch interface [via platform Renderers], having as its child the custom control that needed advanced touch, and passing it in to custom child constructor as an ITouch. For example, to add touch to an OpenGL view. Or a Pan Gesture Behavior that knows where the original Down location was. A bit of code behind where we need it, but will get us through the next six months. So will revisit "doing it right" sometime in 2019.

-- ToolmakerSteve

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions