[英]How to bind MapIcon on Bing Map in Windows Phone 8.1
我在Windows Phone 8.1應用程序上使用“必應地圖”。 基本上,在XAML文件中,我寫了
<Maps:MapControl x:Name="Map" Loaded="Map_Loaded">
<Maps:MapItemsControl ItemsSource="{Binding Locations}">
<Maps:MapItemsControl.ItemTemplate>
<DataTemplate>
<Image Source="Images/arte_icon_label.png"
Height="25"
Maps:MapControl.Location="{Binding Geopoint}"
Maps:MapControl.NormalizedAnchorPoint=".5,.5"/>
</DataTemplate>
</Maps:MapItemsControl.ItemTemplate>
</Maps:MapItemsControl>
</Maps:MapControl>
我想添加許多圖像,但是我不知道添加主題的代碼過程是什么。
你能幫我嗎?
您是否要使用C#代碼添加多個MapIcon? 我從下面的帖子中獲得了此代碼段。
private async Task SearchNearbyIncidents(Geopoint location)
{
IList<Geopoint> geoPoints = await bingMapRestService.GetIncidents(MapUtil.GetBoundingBox(location.Position, 5), ConstantValues.BingMapKey);
foreach (var geoPoint in geoPoints)
{
MapIcon mapIcon = new MapIcon
{
Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/TrafficYield.png")),
Location = geoPoint,
NormalizedAnchorPoint = new Point(0.5, 0.5),
Title = "Incidents"
};
mapControl.MapElements.Add(mapIcon);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.