wp7绑定图钉列表到Maplayer

时间:2012-05-04 08:43:14

标签: windows-phone-7 binding map bing-maps

我想将我的图钉(这是一个列表)绑定到My Map的Maplayer。

MapLayers属性中没有“ItemSource”这样的东西。如何将我的图钉列表数据绑定到MapLayer?

<my:Map HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Name="map1" CredentialsProvider="KEY" >
    <my:Map.Children>
         <my:MapLayer x:Name="pushPinMapLayer" ??Binding what???}">
         </my:MapLayer>
    </my:Map.Children>
</my:Map>

1 个答案:

答案 0 :(得分:1)

请查看下面的链接,因为它是我前一段时间提出的问题(它的哪一部分可以解决您的问题)

Binding Pushpins

我认为对你最有帮助的部分是Xaml(在Map&gt; ItemsControl元素中)

    <my:Map Height="520" HorizontalAlignment="Left" Margin="6,6,0,0" Name="map1" VerticalAlignment="Top" Width="468" ZoomBarVisibility="Collapsed" ZoomLevel="1" CredentialsProvider="{Binding bingMapsCredentials}" >
        <my:MapLayer x:Name="myPushpinLayer"> 
             <my:MapItemsControl Name="Pushpinsss" ItemTemplate="{StaticResource LogoTemplate}" ItemsSource="{Binding PushpinCollection}" >
                 </my:MapItemsControl> 
        </my:MapLayer>
    </my:Map> 

您需要在MapLayer

下添加MapItemsControl部分
相关问题