Learn how to use Bing Maps Silverlight Control (1): Prepare and create

Source: Internet
Author: User
Tags website hosting

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 .)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.