c# Windows Phone 8.1 How to get Geocoordinate obje

2019-09-14 03:20发布

I need to get Geocoordinate object with my Longitude and Latitude. Cannot get Geocoordinates by new() https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geocoordinate One way is for example this code

var locator = new Geolocator();
        locator.DesiredAccuracyInMeters = 50;
        var position = await locator.GetGeopositionAsync();
        Geocoordinate Coordinate = position.Coordinate;

Which gets GPS coordinate. But I need Geocoordinate with my Longitude and Latitude.

1条回答
Ridiculous、
2楼-- · 2019-09-14 04:09

You cannot create a Geocoordinate since it is a sealed, read-only class. Instead, bind to a Geopoint, which contains all the location info you need without the location service baggage that Geocoordinate has.

public Geopoint Location { get; set; }

Maps:MapControl.Location="{Binding Location}"

查看更多
登录 后发表回答