Quiet
Quiet

Reputation: 115

c# Windows Phone 8.1 How to get Geocoordinate object

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.

Upvotes: 0

Views: 590

Answers (1)

Paul Abbott
Paul Abbott

Reputation: 7211

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

Upvotes: 1

Related Questions