void geoCoordinateWatcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { if (e.Status == GeoPositionStatus.Ready) { geoCoordinateWatcher.Stop(); GeoCoordinate location = geoCoordinateWatcher.Position.Location; double zoomLevel = 15; BingMap1.SetView(location, zoomLevel); mapPushpin = new Pushpin(); mapPushpin.Location = location; BingMap1.Children.Add(mapPushpin); } }
private void BingMap1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Point tapPoint = e.GetPosition(BingMap1); BingMap1.Children.Clear(); GeoCoordinate loc = BingMap1.ViewportPointToLocation(tapPoint); mapPushpin = new Pushpin(); mapPushpin.Location = loc; // Add the MapLayer to the Map so the "Pushpin" gets displayed BingMap1.Children.Add(mapPushpin); task.Latitude = loc.Latitude; task.Longitude = loc.Longitude; }