MarTech
MarTech

Reputation: 115

Bing map on WP7

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

Answers (3)

Tom Verhoeff
Tom Verhoeff

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

Claus J&#248;rgensen
Claus J&#248;rgensen

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

Den
Den

Reputation: 16826

It all relies on instances of Pushpin that are placed on a map layer. You can see a short working sample here.

Upvotes: 0

Related Questions