c# Windows Phone 8.1 How to get Geocoordinate object

不问归期 提交于 2019-12-25 12:42:06

问题


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:


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}"



来源:https://stackoverflow.com/questions/33639477/c-sharp-windows-phone-8-1-how-to-get-geocoordinate-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!