Tip Of The Day #117 - Adding Bing Maps References

Pazartesi, 10 Mayıs 2010 15:00 by ikivanc
In this tip we will see how to add bing maps control to our silverlight web application. After downloading and installing Bing Maps SDK on our computer, we can add references from "C:\Program Files\Bing Maps Silverlight Control\V1\Libraries" folder path to our Silverlight Application.

Now Open silverlight application in VS2010 or Expression Blend 4, Right-Click on the Silverlight Application, Click Add Reference then open dialog below appears then select DLLs from their path.


After adding this DLLs ,now open this project in Expression Blend then from Asset Library we can see our Map Control. Drag&Drop it to our silverlight page.

 
As you see we added a map control to our project.

XAML code
<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Microsoft_Maps_MapControl="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl" x:Class="SilverlightBingMaps.MainPage"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
 
  <Grid x:Name="LayoutRoot" Background="White">
 
    <Microsoft_Maps_MapControl:Map Margin="8,30,37,47"/>
 
  </Grid>
</UserControl>


As you see we only added references to project, with this we can easily add a Bing Map control to a Silverlight web application and develop rich silverlight applications.

All the best

Yorumlar