I am just trying to get Lat/Long on a left mouse click.
private void MapView_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
Point pt = e.GetPosition(MainMapView);
MapPoint mapLocation = _mapView.ScreenToLocation(pt);
if (mapLocation == null)
{
locStr = "BAD LOCATION!";
}
...
}
I get BAD LOCATION every time (the return MapPoint is null). I have debugged the e.GetPosition and it is valid value based on the location of the map view I click on. There doesn't seem to any documentation as to why ScreenToLocation would return null give two valid points.
I'm guessing my _mapView isn't initialized correctly, but I don't know what else I need to do. I can can scroll around and zoom in and out with the mouse, so the actual view seems to be working just fine.
Any ideas what is going on here?