I'm trying to add my Bing maps key I got from here http://www.bingmapsportal.com/ but when I add the credentials property to the map like below it gives me the following errors. Is it a different method for adding to phone or have I made a mistake somewhere?

<maps:Map x:Name="MyMap" Credentials="my key..." ZoomLevel="5" HorizontalAlignment="Left" Height="603" LandmarksEnabled="True" PedestrianFeaturesEnabled="True" VerticalAlignment="Top" Width="456" >

Error   1   The member "Credentials" is not recognized or is not accessible.
Error   2   The property 'Credentials' was not found in type 'Map'

.

有帮助吗?

解决方案

If using WP7:

You need to add the CredentialsProvider attribute to the XAML:

<my2:Map HorizontalAlignment="Left" Margin="14,23,0,0" Name="map2" VerticalAlignment="Top"
Loaded="map2_Loaded" Height="534" Width="436" CredentialsProvider= "Ahk5en93JIJlP4ObG_CqLoLgWU22jhPFJbe52bOTjw_hYxB3EtthoVL" />

The key above is taken from the maps portal website. See this guide for more info:

http://www.c-sharpcorner.com/UploadFile/raj1979/how-to-use-the-bing-map-control-in-windows-phone-7/

If using WP8:

See here, this property is no longer used as the functionality that you use the API key for is built into the SDK, so no need to make any calls to MS servers.

CredentialsProvider for the bing map in windows phone 8 application

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top