3
我如何繪製冰箭地圖?或者實際上我想添加一個標記。我已經檢測到座標,現在我想在帶有標記的地圖上顯示此地點...在冰箭地圖上繪製?
我如何繪製冰箭地圖?或者實際上我想添加一個標記。我已經檢測到座標,現在我想在帶有標記的地圖上顯示此地點...在冰箭地圖上繪製?
要在地圖上繪製線條,請使用MapPolyline
元素作爲Map
控件的子項。要向Map
控件添加標記,您需要添加一個Pushpin
元素作爲Map
控件的子項。要添加多個項目(線或圖釘),請將MapItemsControl
作爲Map
控件的子項添加,並指定ItemsSource
和ItemTemplate
。
下面的代碼示例顯示了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還可以幫助您開始使用。