Windows phone 7 如何仅在地图的可视区域显示图钉
我试图在地图上显示图钉,但由于我有很多图钉,我只想显示地图可视区域内的图钉,希望这能使地图更具响应性 我从数据库的查询中得到我的XY点列表。 这是我目前掌握的代码Windows phone 7 如何仅在地图的可视区域显示图钉,windows-phone-7,pushpin,Windows Phone 7,Pushpin,我试图在地图上显示图钉,但由于我有很多图钉,我只想显示地图可视区域内的图钉,希望这能使地图更具响应性 我从数据库的查询中得到我的XY点列表。 这是我目前掌握的代码 List<Pushpin> ListofPoints = new List<Pushpin>(); foreach (var element in query) { //Add a pin to the map P
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();
List ListofPoints=new List();
foreach(查询中的var元素)
{
//在地图上添加一个pin
图钉图钉=新图钉();
位置=新位置();
location.Latitude=Convert.ToDouble(element.X);
location.Longitude=Convert.ToDouble(element.Y);
图钉。位置=位置;
添加点列表(图钉);
映射1.子对象.添加(图钉);
}
//基于图钉点集合的位置贴图
var x=从点列表中的l开始
选择l.位置;
map1.SetView(LocationRect.CreateLocationRect(x));
list of points.Clear();
关于如何仅在地图可视区域显示点,有人能给我一些建议/代码吗
谢谢使用
视图更改开始
和视图更改结束
事件获取更改后的当前视图,然后根据需要重新查询数据集并更新显示的PIN。使用视图更改开始
和视图更改结束
事件获取更改后的当前视图,然后重新查询您的PIN数据集并根据需要更新显示的PIN。可能重复的可能重复的