Are you looking to find the current location in the Windows Phone using c# and later pin it on to the map? Below is a sample code snippet that demonstrates how to achieve it.
How to Get the Current Location and Pin it on the Map in Windows Phone 8?
Code to get the Current Location
private async Task<GeoCoordinate> GetCurrentLocation() { Geolocator Loc = new Geolocator(); Loc.DesiredAccuracy = PositionAccuracy.High; Geoposition pos = await Loc.GetGeopositionAsync(); return new GeoCoordinate(pos.Coordinate.Latitude, pos.Coordinate.Longitude); }
Code to Plot the Location to Map using MapsTask
MapsTask mapTask = new MapsTask(); mapTask.ZoomLevel = 18; mapTask.Center = await GetCurrentLocation();; mapTask.Show();
Leave a Reply