You have 2 ways to go:
(1) Create any UIElement to go to PushPinLayer.AddChild. The AddChild method will accept any UIElement, for example, an image in this case:
MapLayer m_PushpinLayer = new MapLayer(); Your_Map.Children.Add(m_PushpinLayer); Image image = new Image(); image.Source = ResourceFile.GetBitmap("Images/Me.png", From.This); image.Width = 40; image.Height = 40; m_PushpinLayer.AddChild(image, new Microsoft.Maps.MapControl.Location(42.658, -71.137), PositionOrigin.Center);
(2) Create your own PushPin objects to pass to PushpinLayer.AddChild, but first set the Template property. Note that PushPin are ContentControls and have a Template property that can be set from a resource defined in XAML:
MapLayer m_PushpinLayer = new MapLayer(); Your_Map.Children.Add(m_PushpinLayer); Pushpin pushpin = new Pushpin(); pushpin.Template = Application.Current.Resources["PushPinTemplate"] as (ControlTemplate); m_PushpinLayer.AddChild(pushpin, new Microsoft.Maps.MapControl.Location(42.658, -71.137), PositionOrigin.Center); <ResourceDictionary xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ControlTemplate x:Key="PushPinTemplate"> <Grid> <Ellipse Fill="Green" Width="15" Height="15" /> </Grid> </ControlTemplate> </ResourceDictionary>
source share