How to get coordinates when a user clicks on a map in Xamarin.Forms?

In my Xamarin.Forms (PCL project), I want to get the coordinate (lat and long) when the user clicks on the map, but I cannot find any tap event in Map . I think that using the TapGestureRecognizer class object will not help in this case.

So, is there any method that we can perform on our own platform for recognizing a crane and obtaining the coordinates of this area / point?

Any blog post or technique will be helpful.

Thanks.

+6
source share
2 answers

I implemented simple advanced map control to provide pinouts for all three platforms. You can look here . This is a clean sample code, not for production, works great for me, but if you have any problems, please tell me.

+3
source

At this point, I do not believe that any of the nujets designed to work with Xamarin map abstraction will handle this very specific thing. You may need to do your own implementations and use the dependency injection pattern to make the appropriate calls.

Interface in PCL

interface IMaps { public GetLatLong(); } 

Android Native Implementation

see How to get latitude and longitude on a map in Android?

Original iOS implementation

see Map of Ios: obtaining latitude and longitude

Calling Your PCL Implementations

 public point HandleMapOnClick() { return DependencyService.Get<IMaps>().GetLatLong(); } 
+1
source

Source: https://habr.com/ru/post/985023/


All Articles