0
我很難試圖從MapLocationFinderResult列表中獲取多個項目。 我使用foreach循環嘗試:C#迭代MapLocationFinderResult
private async void GetRouteAndDirections()
{
// Query hint
queryHint = new BasicGeoposition();
queryHint.Latitude = -37.8136;
queryHint.Longitude = 144.9631;
Geopoint hintPoint = new Geopoint(queryHint);
// Start
//BasicGeoposition startLocation = new BasicGeoposition();
result = await MapLocationFinder.FindLocationsAsync(addressToGeocode, hintPoint, 10);
// End
// Get route
// Show
if (result.Status == MapLocationFinderStatus.Success)
{
foreach (MapLocation i in result.Locations)
{
txtMessage.Text += (result.Locations[i].Address.Street + " \n"); // need to figure out how to iterate over this
}
AddMapIcon();
}
的錯誤是:
嚴重性代碼說明項目文件的線路抑制狀態 錯誤CS1503參數1:無法從「Windows.Services.Maps轉換.MapLocation」到 '廉政' MapsApp C:\用戶\羅伯特\ OneDrive \ VSProjects \ MapsApp \ MapsApp \ MainPage.xaml.cs中72活動
我應該試圖投它,不知何故?
這是使用Windows.Services.Maps; Windows.Devices.Geolocation; Windows.UI.Xaml.Controls.Maps
非常感謝! – ionside