【发布时间】:2021-04-28 15:36:45
【问题描述】:
从谷歌地图 Api 获取位置并希望在两点之间创建折线但问题是折线->GeoPath 是只读的。 如何将位置分配给 GeoPath 或直接将位置绑定到地图?
我正在关注this sample
Map map = new Map
{
// ...
};
// instantiate a polyline
Polyline polyline = new Polyline
{
StrokeColor = Color.Blue,
StrokeWidth = 12,
Geopath =
{
new Position(47.6381401, -122.1317367),
new Position(47.6381473, -122.1350841),
new Position(47.6382847, -122.1353094),
new Position(47.6384582, -122.1354703),
new Position(47.6401136, -122.1360819),
new Position(47.6403883, -122.1364681),
new Position(47.6407426, -122.1377019),
new Position(47.6412558, -122.1404056),
new Position(47.6414148, -122.1418647),
new Position(47.6414654, -122.1432702)
}
};
// add the polyline to the map's MapElements collection
map.MapElements.Add(polyline);
【问题讨论】:
-
您可以将项目添加到 Geopath 集合中,但不能分配新的 Geopath 实例
-
@Jason 已经有 IList
但如何将它与 Map 绑定?请解释
标签: c# .net xamarin xamarin.forms xamarin.android