unstuck
unstuck

Reputation: 3

How to implement Pointer-/MouseMoveEvents in Xamarin UWP app?

I have a Xamarin app. (Only) for the UWP app I need access to the mouse events (PointerMoved- / PointerEntered / PointerPressed-Events).

Until now my entire codebase is shared code.

Can somebody help me with forwarding the mouse events to the shared Code base? I googled a lot and nearly all answers either suggest a paid libary called "MR.Gestures" or say that it is not possible to recieve mouse Events (like this one I am not able to implement MouseUp, MouseDown and mouseMove Events in Xamarin Mobile applications). Sometimes GestureRecogniser are mentioned, but they Arent extensible, so how are they supposed to help?

Is there really no way to recieve mouse Events in xamarin?

Upvotes: 0

Views: 431

Answers (1)

Ivan I
Ivan I

Reputation: 9990

You can do this. However it is a very extensive work to the level that you might consider to write your app in the native UWP XAML and share some C# code with the Xamarin project instead.

The way would be to extend each control that you are going to use (yes every single control that needs this effect), add to it those events and then write the UWP custom renderers that would invoke those events and then replace all controls in your XAML with those controls.

As said this may turn to be quite extensive work, but that's how it can be done.

Also if you don't need those events but just some visual effects on those events it may be possible to cut on this work by writing a custom XAML styles for those controls in app.xaml in the UWP project.

Upvotes: 1

Related Questions