I'm using the RadMap control for an address location project. From a list, the user selects an address (lat, lon) and a Bing map is centered in the RadMap control. This works just fine. The map is drawn with the selected address centered in the RadMap control.
Now, I want to add a pushpin at the address location. Using the code below, my image is inserted but not at the correct location. The center of the 16x16 pushpin is actually the upper left corner of the RadMap control. The pushpin needs to be in the center (at least initially) of the RadMap. If the user zooms and/or pans, the pushpin also needs to pan/zoom in order to show the selected address.
This does not appear to an issue with screen coordinates vs. geographic coordinates. The upper left corner of the RadMap is 300,400 and the geographic coords are +45 (N), -90 (W). If I move the RadMap around in design and run the app again, the pushpin is always in the upper left corner.
What am I doing wrong?
Thanks,
Scott
radMap1.Provider = new BingMapProvider(MapMode.Road, true, BingMapsKey); |
radMap1.Center = new Location(selectedResult.Latitude, selectedResult.Longitude); |
radMap1.ZoomLevel = 15; |
MapPinPoint pinPoint = new MapPinPoint() |
{ |
Background = new SolidColorBrush(Colors.White), |
Foreground = new SolidColorBrush(Colors.Red), |
FontSize = 14, |
ImageSource = new BitmapImage(new Uri(@"C:\Users\XXX\Desktop\location_16x16.png", UriKind.Absolute)) |
}; |
MapLayer.SetLocation(pinPoint, new Location(selectedResult.Latitude, selectedResult.Longitude)); |
InformationLayer layer = new InformationLayer(); |
layer.Items.Add(pinPoint); |
radMap1.Items.Add(layer); |