To add a pin to the map:
var overlay = new MapOverlay
{
PositionOrigin = new Point(0.5, 0.5),
GeoCoordinate = location, // takes a GeoCoordinate instance. convert Geoposition to GeoCoordinate
Content = new TextBlock{Text = "hello"}; // you can use any UIElement as a pin
};
var ml = new MapLayer { overlay };
map.Layers.Add(ml);
You can append the latitude and longitude of your position as a query in the URI you pass to NavigationSerivce.Navigate
, and extract it in the OnNavigatedTo
event handler with e.Uri.Query
.
A tip. Task.Run
schedules your task to run on the thread-pool. Your task is not CPU-bound and therefore Task.Run will not give you any performance gains.
Edit: Convert a Geoposition to GeoCoordinate with this:
var location = new GeoCoordinate(geoposition.Coordinate.Latitude, geoposition.Coordinate.Longitude);
A very useful resource is the Nokia WP8 Guide