我对Bing地图的概念非常陌生
需求:需要设计一个具有自定义Pushpin的必应地图和Bing地图上的多个层:使用键和2个DLL创建Bing映射,添加多个图钉,使用MapPolygon在地图上添加一个形状
问题:
急需帮助
发布于 2012-05-02 17:42:30
你试过微软提供的交互式SDK吗?它帮了我。
似乎您只需要放置一个MapLayer
并在其中放置Pushpin
控件。您可以使用MapLayer.Position
附加属性将该映射层中的任何内容固定到映射中;这样,当用户移动地图时,它会说。此附加属性的类型为Location
,它是必应地图控件的专有类型,包含经度(双)和纬度(双)值。如果需要绑定所述位置的集合,则可以在MapLayer
的内部使用MapLayer
,将其ItemsSource
属性绑定到集合。您还可以创建数据模板;只需记住,模板根必须使用MapLayer.Position
附加属性来指定其在地图上的位置。这可以绑定到任何Location
-typed值。
<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>
https://stackoverflow.com/questions/10345561
复制相似问题