2011-01-27 36 views
3

我如何繪製冰箭地圖?或者實際上我想添加一個標記。我已經檢測到座標,現在我想在帶有標記的地圖上顯示此地點...在冰箭地圖上繪製?

回答

2

要在地圖上繪製線條,請使用MapPolyline元素作爲Map控件的子項。要向Map控件添加標記,您需要添加一個Pushpin元素作爲Map控件的子項。要添加多個項目(線或圖釘),請將MapItemsControl作爲Map控件的子項添加,並指定ItemsSourceItemTemplate

下面的代碼示例顯示了PushPin顯示當前位置,並且MapItemsControl顯示的路線上航點:

<maps:Map x:Name="_map" 
      CopyrightVisibility="Collapsed" 
      CredentialsProvider="Your API Key Here" 
      LogoVisibility="Collapsed"> 
    <maps:MapItemsControl ItemsSource="{Binding WayPoints}"> 
     <maps:MapItemsControl.ItemTemplate> 
      <DataTemplate> 
       <maps:Pushpin Background="{Binding BackgroundBrush}" Location="{Binding Location}"/> 
      </DataTemplate> 
     </maps:MapItemsControl.ItemTemplate> 
    </maps:MapItemsControl> 
    <maps:Pushpin x:Name="_current" Background="Blue" Location="{Binding CurrentLocation}"/> 
</maps:Map>

blog post還可以幫助您開始使用。