Windows phone 7 ObservableCollection仅更新地图缩放和移动事件,不添加到集合中!
我对绑定的集合有问题。我有一个手动刷新按钮,可以从服务器上拉出一些移动的图钉。服务器正在自行移动PIN。处理后,我删除现有集合并将其重新添加到可观察集合中。这段代码是有效的,我已经验证了内容已经更新,但是如果地图发生缩放或移动,引脚只会“更新”(在地图上移动) 我的课程如下Windows phone 7 ObservableCollection仅更新地图缩放和移动事件,不添加到集合中!,windows-phone-7,observablecollection,Windows Phone 7,Observablecollection,我对绑定的集合有问题。我有一个手动刷新按钮,可以从服务器上拉出一些移动的图钉。服务器正在自行移动PIN。处理后,我删除现有集合并将其重新添加到可观察集合中。这段代码是有效的,我已经验证了内容已经更新,但是如果地图发生缩放或移动,引脚只会“更新”(在地图上移动) 我的课程如下 public class MapData : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyCha
public class MapData : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private void RaisedPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
private GeoCoordinate mapCenter = new GeoCoordinate(50, -1);
public GeoCoordinate MapCenter
{
get { return this.mapCenter; }
set
{
if (this.mapCenter == value) return;
this.mapCenter = value;
this.RaisedPropertyChanged("MapCenter");
}
}
private double zoom = 7.0;
public double Zoom
{
get { return this.zoom; }
set
{
if (this.zoom == value) return;
this.zoom = value;
this.RaisedPropertyChanged("Zoom");
}
}
public ObservableCollection<Plane> pins = new ObservableCollection<Plane>() {
};
public ObservableCollection<Plane> Pins
{
get { return pins; }
}
public void RemovePoints()
{
for (int i = 0; i < pins.Count; i++)
{
pins.RemoveAt(i);
}
pins.Clear();
this.RaisedPropertyChanged("Location");
}
public void AddPoints(List<Plane> Planelist)
{
for (int i = 0; i < Planelist.Count; i++)
{
pins.Add(Planelist[i]);
}
}
private Plane selectedPin;
public Plane SelectedPin
{
get {
return this.selectedPin;
}
set
{
if (this.selectedPin == value) return;
this.selectedPin = value;
this.RaisedPropertyChanged("SelectedPin");
}
}
private LocationCollection routePoints = new LocationCollection();
public LocationCollection RoutePoints
{
get { return routePoints; }
}
}
公共类映射数据:INotifyPropertyChanged
{
公共事件属性更改事件处理程序属性更改;
私有void RaisedPropertyChanged(字符串propertyName)
{
if(PropertyChanged!=null)
{
PropertyChanged(这是新的PropertyChangedEventArgs(propertyName));
}
}
专用地理坐标地图中心=新地理坐标(50,-1);
公共地理坐标地图中心
{
获取{返回this.mapCenter;}
设置
{
如果(this.mapCenter==值)返回;
this.mapCenter=值;
此.RaisedPropertyChanged(“地图中心”);
}
}
私人双变焦=7.0;
公共双变焦
{
获取{返回this.zoom;}
设置
{
如果(this.zoom==值)返回;
this.zoom=值;
此.RaisedPropertyChanged(“缩放”);
}
}
公共ObservableCollection引脚=新ObservableCollection(){
};
公共可观测收集管脚
{
获取{返回管脚;}
}
公共无效删除点()
{
对于(int i=0;i
它是使用以下命令绑定的
<my:MapItemsControl ItemsSource="{Binding Pins}" ItemTemplate="{StaticResource PushedMe}"/>
与Microsoft交谈后,设备似乎会缓存URL,这实际上是我的问题!服务器端强制无缓存,问题已修复