Вопрос

Does anyone know how to databind pushpins in the Nokia Map control? Thanks!

Это было полезно?

Решение

You can use the Windows Phone Toolkit to add children to the map. The Toolkit contains some controls and extensions that make this easier to work with.

<maps:Map x:Name="myMap">
    <toolkit:MapExtensions.Children>
        <toolkit:UserLocationMarker x:Name="UserLocationMarker" />
        <toolkit:Pushpin x:Name="MyPushpin" Content="My Position"></toolkit:Pushpin>
    </toolkit:MapExtensions.Children>
</maps:Map>

You can even use templating to bind to a collection of items.

<maps:Map x:Name="myMap">
    <toolkit:MapExtensions.Children>
        <toolkit:MapItemsControl ItemsSource="{Binding MapItems}">
            <toolkit:MapItemsControl.ItemTemplate>
                <DataTemplate>
                    <toolkit:Pushpin GeoCoordinate="{Binding Coordinate}" Content="{Binding Name}" />
                </DataTemplate>
            </toolkit:MapItemsControl.ItemTemplate>
        </toolkit:MapItemsControl>
    </toolkit:MapExtensions.Children>
</maps:Map>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top