1
我正在构建一个windows phone 8.1应用程序,该应用程序读取一个文件(其中包含GPS点,每个点包含例如纬度和经度字段)。对于每一个点我都有,所以它在地图控件上显示一个小图钉图标,基于它从上面的文件进行协调。有什么方法可以在推针元素上实现点击事件并将其用于例如显示另一个窗口,用户可以更改/显示特定点/图钉信息(经度或纬度)?这是我使用读取地图上我的文件,并显示什么,以及它工作得很好:地图图钉点击事件
信息:notes
是public ObservableCollection<Point> notes;
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
bool exist; // used to check if JSON file exists
// get current position and set the map to point at it
Geoposition position = await App.DataModel.GetCurrentPosition();
await MyMap.TrySetViewAsync(position.Coordinate.Point, 16D);
mySlider.Value = MyMap.ZoomLevel; // set it to 16D from previous line
exist = await App.DataModel.FileExistsAsync();
if (exist == true)
{
// read the file and load points into a list
await App.DataModel.ReadFile();
// put points on the map - little map icon
foreach (var point in App.DataModel.notes)
{
MapIcon myMapIcon = new MapIcon();
myMapIcon.Location = new Geopoint(new BasicGeoposition()
{
Latitude = point.Latitude,
Longitude = point.Longitude,
});
myMapIcon.NormalizedAnchorPoint = new Point(0.5, 1.0);
MyMap.MapElements.Add(myMapIcon);
}
}
}
感谢我指出了正确的方向。现在我有一个自定义的xaml控件,可以响应用户输入 – Dodi 2014-10-27 19:01:55