1 Preparation
1.1 go to http://www.bingmapsportal.com/and apply for an Development key;
1.2 to http://www.microsoft.com/en-us/download/details.aspx? Id = 2949 download Bing Maps Silverlight control SDK;
1.3 install the SDK after the download is complete.
2. New
2.1 create a Silverlight project and its website hosting;
2.2 add reference to Silverlight project: Local installation directory (c: \ Program Files (x86) \ Bing Maps Silverlight control \ V1 \ libraries) of Bing Maps Silverlight Control) 2 DLL files: Microsoft. maps. mapcontrol. common. DLL and Microsoft. maps. mapcontrol. DLL, add references to it;
2.3 open mainpage. XAML and add:
xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl"
To add reference to the Bing Maps Silverlight control namespace on this page;
2.4 Add the following tags to the grid:
<m:Map CredentialsProvider="AkzZURoD0H2Sle6Nq_DE7pm7F3xOc8S3CjDTGNWkz1EFlJJkcwDKT1KcNcmYVINU" Height="250" Width="350"></m:Map>
You can add the Bing Maps control. The credentialsprovider is the key we just applied.
2.5 so far, you can see the effect of the Bing Maps control. Start debugging to check whether the control is successful!
2.6 Add a few simple settings:
<m:Map CredentialsProvider="AkzZURoD0H2Sle6Nq_DE7pm7F3xOc8S3CjDTGNWkz1EFlJJkcwDKT1KcNcmYVINU" NavigationVisibility="Collapsed" CopyrightVisibility="Collapsed" LogoVisibility="Collapsed" ScaleVisibility="Collapsed" Mode="AerialWithLabels"></m:Map>
First, in addition to the map content, the control interface also has four display information. We can control the display or hiding by setting its visibility. They are: navigation in the upper left corner, Bing trademark in the lower left corner, scale in the lower right corner, and copyright ).
There is also mode that can specify the display layer of the map. There are two types in total: A common map (road) and a satellite map (without the flag: aerial, with the flag: aerialwithlabels ). Aerialwithlabels can also set Automatic label hiding:
<m:Map CredentialsProvider="AkzZURoD0H2Sle6Nq_DE7pm7F3xOc8S3CjDTGNWkz1EFlJJkcwDKT1KcNcmYVINU" NavigationVisibility="Collapsed" CopyrightVisibility="Collapsed" LogoVisibility="Collapsed" ScaleVisibility="Collapsed"> <m:Map.Mode> <m:AerialMode Labels="True" FadingLabels="True" /> </m:Map.Mode></m:Map>
In this way, when the mouse cursor is placed on the map, it is marked and hidden after leaving.
The whole world is much refreshed...
(For the above content, refer to: Workshop .)