基于在Bing的Windows Phone 7的KML文件显示位置 [英] Display locations based on KML file in Bing Windows Phone 7

查看:149
本文介绍了基于在Bing的Windows Phone 7的KML文件显示位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我使用如下代码显示在我的应用程序中的地图上的位置:

  // Bustop 8448  -  

图钉BusStop8448 =新图钉();
BusStop8448.Background =新的SolidColorBrush(Colors.Red);
BusStop8448.Location =新会有地理座标(-36.934608,174.73016);
BusStop8448.Content =公共汽车站:8448;
BusStop8448.MouseLeftButtonUp + =新MouseButtonEventHandler(BusStop8448_MouseLeftButtonUp);
VAR BusStop8448Press =发件人为图钉;


this.Map.Children.Add(BusStop8448);

这是因为有数百个地点增加非常繁琐,所以我在想显示的位置根据在KML文件。



我的问题是我怎么显示基于在Windows Phone 7的Bing地图?


$ b KML文件图钉$ b

另外,我想知道是否有有每个从KML文件,这些图钉的onclick事件的方法。



目前我使用下面的代码,工作文件,但我不知道我怎么会实现了与基于KML图钉

 无效BusStop8679_MouseLeftButtonUp(对象发件人,MouseButtonEventArgs E)
{

INT ID = 8679;
NavigationService.Navigate(新的URI(/ DepartureBoard.xaml ListingId =?+ ID,UriKind.Relative));
}


解决方案

解析在KML的坐标文件(使用 RestSharp 或一个XML解串器将使它很容易的),然后使用的数据绑定绑定坐标列表的视图,并使用<一个HREF =http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemtemplate.aspx相对=nofollow> ItemTemplate中定制图钉本身。



您可以再附上一个事件侦听器的点击事件。将标签属性 {结合} ,并读出在点击元素,然后您可以访问元素你点击。


Currently i am using the following code to display locations on a map in my application:

    //Bustop 8448 – 

    Pushpin BusStop8448 = new Pushpin();
    BusStop8448.Background = new SolidColorBrush(Colors.Red);
    BusStop8448.Location = new GeoCoordinate(-36.934608, 174.73016);
    BusStop8448.Content = "Bus Stop: 8448 ";
    BusStop8448.MouseLeftButtonUp += new MouseButtonEventHandler(BusStop8448_MouseLeftButtonUp);
    var BusStop8448Press = sender as Pushpin;


    this.Map.Children.Add(BusStop8448);

This is very tedious as there are hundreds of locations to add, so I was thinking about displaying locations based on a KML file.

My question is how do I display pushpins based on a KML file in windows phone 7 Bing Maps?

Also, I would like to know if there is a way of having an Onclick event for each of these pushpins from the KML file.

Currently I am using the below code which works file, but I 'm not sure how I would implemented that with KML based pushpins

void BusStop8679_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{

    int id = 8679;
    NavigationService.Navigate(new Uri("/DepartureBoard.xaml?ListingId=" + id, UriKind.Relative));           
}

解决方案

Parse the coordinates in the KML file (using RestSharp or a XML de-serializer would make it very easy), then use databinding to bind the coordinate list to the view, and use a ItemTemplate to customize the pushpin itself.

You can then attach a event listener for the Tap event. Set the Tag property to {Binding} , and read it out in the Tap element, and then you can access the element you clicked.

这篇关于基于在Bing的Windows Phone 7的KML文件显示位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆