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