How can i display a list of positions (from a xml docu开发者_如何学Goment:using xml reading) in a Bing map with WP7? The idea is similar to Foursquare.
Microsoft wrote a good throughout tutorial on the subject, that also explains how to use databinding, so you can do proper code and view seperation.
It all relies on instances of Pushpin that are placed on a map layer. You can see a short working sample here.
The tutorial linked by Claus nicely points out how you can use Pushpins on a BingMapsControl. If you take out the essence of the tutorial this is the piece of code you want to use. All you need is a collection of items with at least a Location attribute. If you want your Pushpin to have a label you can also add a Name attribute.
You can databind the collection of items to your mapcontrol by adding this piece of code within your BingMapsControl.
<maps:MapItemsControl ItemsSource="{Binding Items}" >
<maps:MapItemsControl.ItemTemplate>
<DataTemplate>
<maps:Pushpin Content="{Binding Name}" Location="{Binding Location}"/>
</DataTemplate>
</maps:MapItemsControl.ItemTemplate>
</maps:MapItemsControl>
If you need any more explanation please refer to the tutorial mentioned by Claus
精彩评论