Accessing the Control Using a Bing Maps Key
This documentation is no longer available on MSDN, however it is available as a CHM download.
To access the Bing Maps Silverlight Control and the functionality it provides, you need a Bing Maps Key, which you can get from the Bing Maps Account Center. Information about creating a Bing Maps Account and getting a Bing Maps Key is found in the Getting a Bing Maps Key topic.
You will see an error message on the map if you do not use a valid Bing Maps Key in your Bing Maps Silverlight Control application.
Use the Bing Maps Key in Your Application
After you have created a Bing Maps Account, available Bing Maps Keys appear in the Bing Maps Account Center. Click the Create or view Bing Maps keys link to view them. Copy the key associated with the Web site URL which corresponds to the application you are building and assign this string value to the ApplicationId property of an ApplicationIdCredentialsProvider object. Use this object to set the CredentialsProvider property of the MapBase class. Or alternatively, you can just set the
CredentialsProvider attribute of your map element in XAML as shown in the example below.
<UserControl x:Class="SilverlightApplication1.MainPage" xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml" xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl" Width="1024" Height="768"> <Grid x:Name="LayoutRoot" Background="White"> <m:Map x:Name="myMap" CredentialsProvider="Your key" Mode="Road"/> </Grid> </UserControl>
When the Bing Maps Silverlight Control is loaded with a valid Bing Maps Key, Bing Maps counts sessions. A session begins with the load of the Bing Maps Silverlight Control into a user’s browser and includes all Bing Maps Silverlight Control interactions until the browser is closed or the user moves to a different page. Bing Maps usage reports are available in the Bing Maps Account Center, as described in Viewing Bing Maps Usage Reports.