【问题标题】:ItemsSource on Nokia's Here Map control for WP8用于 WP8 的诺基亚 Here Map 控件上的 ItemsSource
【发布时间】:2014-02-20 23:22:42
【问题描述】:

有人知道如何在诺基亚地图控件中绑定图钉吗?谢谢!

【问题讨论】:

  • 根据我所阅读的内容,如果不使用自定义属性,我不这么认为。根据参考,他们似乎不希望您在 XAML 中创建 MapLayer。正如我暗示的那样,理论上您可以创建一个附加属性,该属性接受对集合的绑定并根据对集合的更改处理引脚。然后,它还可以异步/增量处理更改,以免使 UI 陷入困境。

标签: silverlight xaml windows-phone-8 here-api


【解决方案1】:

您可以使用Windows Phone Toolkit 将子级添加到地图中。该工具包包含一些controlsextensions,这使得它更易于使用。

<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>

您甚至可以使用模板来绑定到项目集合。

<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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-08
    • 2012-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多