Map Class
Bing Services
Represents the default map class.
Namespace: Microsoft.Maps.MapControl
Assembly: Microsoft.Maps.MapControl (in microsoft.maps.mapcontrol.dll)
Assembly: Microsoft.Maps.MapControl (in microsoft.maps.mapcontrol.dll)
The following example adds four maps with different modes to a Grid called LayoutRoot. This example uses C# code instead of XAML.
<UserControl x:Class="SilverlightTest1.ShowMultipleMaps" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://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"> </Grid> </UserControl>
using System.Windows; using System.Windows.Controls; using Microsoft.Maps.MapControl; namespace SilverlightTest1 { public partial class ShowMultipleMaps : UserControl { public ShowMultipleMaps() { InitializeComponent(); //Loads 2 maps side by side initializeMaps(); } private void initializeMaps() { //Create a 2x2 grid LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition()); LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition()); LayoutRoot.RowDefinitions.Add(new RowDefinition()); //Add Road view map Map leftMap = new Map(); leftMap.Mode = new RoadMode(); Grid.SetColumn(leftMap, 0); Grid.SetRow(leftMap, 0); leftMap.CredentialsProvider = New ApplicationIdCredentialsProvider("Your Key"); LayoutRoot.Children.Add(leftMap); //Add Aerial view map Map rightMap = new Map(); rightMap.Mode = new AerialMode(); Grid.SetColumn(rightMap, 1); Grid.SetRow(rightMap, 0); rightMap.CredentialsProvider = New ApplicationIdCredentialsProvider("Your Key"); LayoutRoot.Children.Add(rightMap); } } }