如何使用xaml在Bing地图中绘制折线

时间:2014-09-06 07:29:49

标签: xaml windows-phone-8

我已经附上了这些名称空间:

xmlns:maps="clr-namespace:Microsoft.Phone.Maps.Controls;assembly=Microsoft.Phone.Maps"
xmlns:toolkit1="clr-namespace:Microsoft.Phone.Maps.Toolkit;assembly=Microsoft.Phone.Controls.Toolkit"

我当前的地图标记:

<maps:Map Grid.Row="1" ZoomLevel="5" Height="500" x:Name="map1" Width="415" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,0,0" CartographicMode="Aerial" Visibility="Collapsed">

        </maps:Map>

我需要为它添加折线。

实际上,我已经知道了我想要的整个结构,但它是在另一个基于另一个SDK的Map控件中实现的:

<ymc:Map x:Name="mapYandex"
            ZoomLevel="10"
            Center="58.004116, 56.237987"
            DisplayLayers="map"
            TrafficEnabled="False"
            UseLocation="True" Visibility="Collapsed">
            <ymc:MapLayer Loaded="MapLayer_Loaded">
                <ymc:MapPolyline Name="polilinesF" Stroke="Green" Locations="{Binding LocationsF}"/>
                <ymc:MapPolyline Name="polilinesB" Locations="{Binding LocationsB}"/>
                <ymc:MapItemsControl x:Name="mapItemsControl" >
                    <ymc:MapItemsControl.ItemTemplate>
                        <DataTemplate>
                            <ymc:PushPin
                                Visibility="{Binding Visibility}"
                                ContentVisibility="{Binding ContentVisibility, Mode=TwoWay}"
                                State="{Binding State}"
                                ymc:MapLayer.Location="{Binding Position}"
                                ymc:MapLayer.Alignment="BottomCenter"
                                CacheMode="BitmapCache"
                                ymc:PushPinManagerHelper.GroupKeys="All" >
                                <TextBlock Text="{Binding Name}"></TextBlock>
                            </ymc:PushPin>
                        </DataTemplate>
                    </ymc:MapItemsControl.ItemTemplate>
                </ymc:MapItemsControl>

            </ymc:MapLayer>
        </ymc:Map>

我需要实现相同的结构,但使用Bing Maps。需要帮助。

2 个答案:

答案 0 :(得分:0)

您是否尝试使用MapPolyline而没有MapLayer

此处讨论了同样的问题:

MapPolyline not being drawn

希望它有所帮助!

答案 1 :(得分:0)

Adding Polylines to Bing Maps.

上查看此帖子