我试图在地图上显示图钉,但由于我有很多图钉,我只想在地图的可见区域内显示那些,这应该有望使地图更具响应性。
我从对数据库的查询中获得x y点的列表。这是我到目前为止的代码…
List<Pushpin> ListofPoints = new List<Pushpin>();
foreach (var element in query)
{
//Add a pin to the map
Pushpin pushpin = new Pushpin();
Location location = new Location();
location.Latitude = Convert.ToDouble(element.X);
location.Longitude = Convert.ToDouble(element.Y);
pushpin.Location = location;
ListofPoints.Add(pushpin);
map1.Children.Add(pushpin);
}
// Position map based on a collection of Pushpins points
var x = from l in ListofPoints
select l.Location;
map1.SetView(LocationRect.CreateLocationRect(x));
ListofPoints.Clear();
谁能给我的任何建议/代码如何只显示在地图的可见区域上的点?
谢谢
使用ViewChangeStart
和ViewChangeEnd
事件获得更改后的当前视图,然后查询数据集并根据需要更新显示的引脚