Thiago Valle
Thiago Valle

Reputation: 449

Binding Content in Bing Maps Pushpins

I have some pushpins that are added by binding

<my:MapItemsControl Name="ItinerariesPushpins" ItemsSource="{Binding Itineraries}">

    <my:MapItemsControl.ItemTemplate>
    <DataTemplate>
        <my:Pushpin Location="{Binding Location,
                    Converter={StaticResource LocationGeoCoordinateConverter}}"/>
    </DataTemplate>
</my:MapItemsControl.ItemTemplate>

And i want to bind the content to a collection of numbers, so that each pushpin has a number, is it possible or i am doing something wrong? I created an ObservableCollection and add the numbers there then i bind it.

Help please :(

Upvotes: 1

Views: 970

Answers (1)

Derek Lakin
Derek Lakin

Reputation: 16319

You simply need to put the content in the Pushpin in your ItemTemplate:

<my:Pushpin Location="{Binding Location, Converter={...}}"
            Content="{Binding}" />

This assumes that your ItemsSource Itineraries is simply a collection of some numeric type. If it's a class/struct then just add the right property name to the binding.

Upvotes: 2

Related Questions