0

我对 Bing 地图概念很陌生

要求:需要使用自定义图钉和 Bing 地图上的许多图层设计 Bing 地图 工作完成:使用一个键和 2 个 DLL 创建一个 Bing 地图,添加多个图钉,使用 MapPolygon 在地图上添加一个形状

问题:

  1. 我需要将自定义图钉添加到 Bing 地图(我的项目文件夹中有一个图像,当指定位置时我需要在 Bing 地图上显示它)。我浏览了许多链接,但没有一个对我有用。所以请告诉我在 Bing 地图上显示自定义图钉的方法。

  2. 我需要在 Bing 地图上添加多个图层,而我对此知之甚少。因此,请指导我了解 Silverlight Bing 地图中的分层概念。

急需帮助:(

4

1 回答 1

0

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

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

    <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>
于 2012-05-02T17:42:30.890 回答