Reputation: 3
I'm trying to make a pushpin for my current location, the examples I could find online all give me the same error of "Cannot implicitly convert type 'System.Device.Location.GeoCoordinate' to 'Microsoft.Maps.MapControl.WPF.Location'.
Here is the code segment;
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher();
GeoCoordinate looc = watcher.Position.Location;
Pushpin piin = new Pushpin();
piin.Location = looc; //error here
I'm using XAML and Bing maps if that makes a difference.
Upvotes: 0
Views: 85
Reputation: 1772
You will need to create a new Location object for the pushpin, populating it with the latitude/longitude of the GeoCoordinate object. Note that the WPF control is old and no longer updated. If you're developing a new application it's recommended to use the UWP map control which can handle GeoCoordinate directly.
Upvotes: 0