Xamarin Form Cards - Custom Contact Images

Is there a way to change the image of contacts in Xamarin Forms Maps. I want to make the pin in the usual way, if it needs to be done initially, can someone give me a simple example of this. Thanks.

+6
source share
3 answers

For everyone coming later, this is now well supported in Xamarin Forms.

In essence, you need to create a custom map class in your PCL or generic code that inherits from the Xamarin form map, and then create a custom rendering in each of the platform projects.

These custom renderers will be different for each platform, bearing in mind the specifics of drawing icons and any pop-up information displayed when you click on this output for this particular platform. You are not required to create your own renderer for all platforms, for those that do not appear on a regular map.

This is all now really well documented in Custom Renderers | Configure the Map section of the Xamarin Forms Developer's Guide . This documentation goes through creating your own rendering for Android, iOS, and UWP and explains that the code needs to be detailed. There are many, so I will not reproduce it here. There is also an accompanying sample solution .

It should be noted that if you are trying to reproduce this code in your own project, you will also need to add images to various available folders in the ProjectName \ Droid \ Resources directory, as well as two axml files in the layout directory.

+2
source

This seems to be pretty locked, and you should look at personalized renderers to achieve what you need.

This is stated on the following link: -

http://forums.xamarin.com/discussion/17916/customization-of-xamarin-forms-maps-pins

with a specific link to the project using the following link that someone has implemented custom image peaks from the Assets folder: -

https://github.com/paulpatarinski/ShouldIWashMyCar/blob/master/Android/Renderers/MapViewRenderer.cs

I have not tried this yet, but this would probably be a good start to looking for map rendering.

+1
source

This project may be useful to you. raechten / BindableMapTest

From the description:

A small sample for binding a collection to the contacts of Xamarin Forms Maps (valid until the binding is directly linked to the Pins property of Xamarin Forms Maps directly).

Includes user and interactive contacts.

It implements applications for Android and iOS.

+1
source

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


All Articles