Muhammad Zubair

Muhammad Zubair

  • 969
  • 807
  • 158.8k

How to make custom info window in xamarin forms maps?

Mar 25 2019 11:54 AM

I want to create a custom info window in my Xamarin forms map,How can I implement this.I am using xamarin.forms.map map plugin to create map. Please Help me I want a custom info window like this one

i make custom map and custom pin

  1. public class CustomMap : Map  
  2. {  
  3. public List CustomPins { getset; }  
  4. }
Custom Pin
  1. public class CustomPin : Pin  
  2.  {  
  3.  public string ImageUrl { getset; }  
  4.  public float rating { getset; }  
  5.  }  

Map page xaml.cs

  1. public partial class MapPage : ContentPage  
  2.     {  
  3.         CustomPin pin;  
  4.         MapVM MapVM;  
  5.         public MapPage()  
  6.         {  
  7.             InitializeComponent();  
  8.   
  9.             pin = new CustomPin  
  10.             {  
  11.                 Type = PinType.Place,  
  12.                 Position = new Position(37.79752, -122.40183),  
  13.                 Label = "Xamarin San Francisco Office",  
  14.                 Address = "394 Pacific Ave, San Francisco CA",  
  15.                 Url = "http://xamarin.com/about/",  
  16.                 rating = 3  
  17.   
  18.             };  
  19.             var pin1 = new CustomPin  
  20.             {  
  21.                 Type = PinType.Place,  
  22.                 Position = new Position(38.79752, -124.40183),  
  23.                 Label = "Xamarin San Francisco Office",  
  24.                 Address = "395 Pacific Ave, San Francisco CA",  
  25.                 Url = "http://xamarin.com/about/",  
  26.                 rating=2  
  27.   
  28.             };  
  29.   
  30.             customMap.CustomPins = new List { pin, pin1 };  
  31.              customMap.Pins.Add(pin);  
  32.             customMap.Pins.Add(pin1);  
  33.             customMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(37.79752, -122.40183), Distance.FromMiles(1.0)));  
  34.         }  
  35. }  
now i don't know about custom render class. please help me how i can define custom render class and how i assign the image value and rating values to display in info window..