首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在Silverlight中为Bing地图添加自定义Pushpin

在Silverlight中为Bing地图添加自定义Pushpin
EN

Stack Overflow用户
提问于 2012-04-27 06:04:03
回答 1查看 1.4K关注 0票数 0

我对Bing地图的概念非常陌生

需求:需要设计一个具有自定义Pushpin的必应地图和Bing地图上的多个层:使用键和2个DLL创建Bing映射,添加多个图钉,使用MapPolygon在地图上添加一个形状

问题:

  1. 我需要添加自定义图钉到必应地图(我有一个图像在我的项目文件夹,我需要在必应地图上显示的位置指定)。我经历了很多的环节,没有一个为我工作。所以请告诉我应该遵循什么方法来显示Bing地图上的自定义Pushpin。
  2. 我需要添加多个层的必应地图,我对它的知识最少。因此,请指导我关于银光必应地图的分层概念。

急需帮助

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-05-02 17:42:30

你试过微软提供的交互式SDK吗?它帮了我。

似乎您只需要放置一个MapLayer并在其中放置Pushpin控件。您可以使用MapLayer.Position附加属性将该映射层中的任何内容固定到映射中;这样,当用户移动地图时,它会说。此附加属性的类型为Location,它是必应地图控件的专有类型,包含经度(双)和纬度(双)值。如果需要绑定所述位置的集合,则可以在MapLayer的内部使用MapLayer,将其ItemsSource属性绑定到集合。您还可以创建数据模板;只需记住,模板根必须使用MapLayer.Position附加属性来指定其在地图上的位置。这可以绑定到任何Location-typed值。

代码语言:javascript
运行
复制
    <UserControl x:Class="MapControlInteractiveSdk.Tutorials.DataBinding.TutorialMapItemsControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:t="clr-namespace:MapControlInteractiveSdk.Tutorials.DataBinding"
    xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl">
    <UserControl.Resources>
        <DataTemplate x:Key="LogoTemplate">
            <!-- This doesn't have to be a pushpin control - it can be anything just apply 
                    the "m:MapLayer.Position" property to whatever is the root of the
                    template.
               -->
            <m:Pushpin m:MapLayer.Position="{Binding Location}" />
        </DataTemplate>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <m:Map CredentialsProvider="Your Key">
            <m:MapLayer>
                <m:MapItemsControl x:Name="ListOfItems"
                            ItemTemplate="{StaticResource LogoTemplate}"
                            ItemsSource="{Binding MyLocalizedEntities}">
                </m:MapItemsControl>
            </m:MapLayer>
            <m:MapLayer>
                <!-- You can have content in multiple layers: Latter layers are infront of former ones. -->
            </m:MapLayer>
        </m:Map>
    </Grid>
</UserControl>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10345561

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档