This project has moved. For the latest updates, please go here.

How to create a pushpin in code-behind?

Jan 3, 2013 at 10:46 PM

Sorry for this probably stupid question, but how can I create a pushpin in code-behind and set the location on the map? I know that I must use something like MapControl.Location, but how can I do that?

Regards,

ialokim

Coordinator
Jan 17, 2013 at 7:09 PM

Hi ialokim,

you can add a pushpin to the Map control (or to any MapPanel inside the Map) like this:

var pushpin = new Pushpin();
var location = new Location(54, 8);
MapPanel.SetLocation(pushpin, location);
pushpin.Content = "Hello";
map.Children.Add(pushpin);

And the NuGet package contains only the MapControl library for different platforms. Source code and sample programs are available here.