Hello I'm trying to determine my pushpin by the latitude and longitude but for some reason I get a error line under latitude Pushpin(latitude, longitude) my map is happy to center using the same code if I just change Pushpin to Location but I don't understand why it won't work with Pushpin?
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim latitude As Double = Double.Parse(TXTLAT.Text.Substring(0, TXTLAT.Text.IndexOf(","c)))
Dim longitude As Double = Double.Parse(TXTLong.Text.Substring(TXTLong.Text.IndexOf(","c) + 1))
UserControl11.BingMap.Center = New Microsoft.Maps.MapControl.WPF.Pushpin(latitude, longitude)
End Sub
To center the map you need to pass in a Location object, not a Pushpin. A Pushpin is a UIElement that gets displayed on top of the map, where as the center property is the position of the map. If you want to center the map on a location and also display a pushpin there do the following:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim latitude As Double = Double.Parse(TXTLAT.Text.Substring(0, TXTLAT.Text.IndexOf(","c)))
Dim longitude As Double = Double.Parse(TXTLong.Text.Substring(TXTLong.Text.IndexOf(","c) + 1))
Dim location = New Microsoft.Maps.MapControl.WPF.Location(latitude, longitude)
Dim Pin = New Microsoft.Maps.MapControl.WPF.Pushpin()
pin.Location = location
UserControl11.BingMap.Center = location
End Sub
You can find complete documentation on the Bing Maps WPF control here: https://msdn.microsoft.com/en-us/library/hh750210.aspx