我希望用户在地图上添加几个引脚来表示使用map1_Hold事件的帐篷或人。如何执行此操作并稍后将每个丢弃的pin位置存储在云上(windows azure)?

有帮助吗?

解决方案

要在地图上放置引脚,您可以执行以下操作:(这里 map 来自我的。xaml页面,其中map是地图的名称: <my:Map Name="map" ...

设置事件处理程序

map.Hold += new EventHandler<GestureEventArgs>(dropPin_Hold);

和实际的事件处理程序:

void dropPin_Hold(object sender, GestureEventArgs e)
{
    // drop a pin at the Held location
    GeoCoordinate pinLocation = new GeoCoordinate();
    // gets the dropped position
    pinLocation = map.ViewportPointToLocation(e.GetPosition(map));

    newLocation = new Pushpin() { Location = pinLocation, Name = "Tent's name" Content = "new tent" };
    map.Children.Add(newLocation);

    // save the newLocation however you want

}

多次保持将导致多个引脚显示在地图上。

您可能还想查看地图。水龙头

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top