Reputation: 115
How can i display a list of positions (from a xml document:using xml reading) in a Bing map with WP7? The idea is similar to Foursquare.
Upvotes: 1
Views: 661
Reputation: 1270
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
Upvotes: 0
Reputation: 26346
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.
Upvotes: 1