Export (0) Print
Expand All

Map Class

This documentation is no longer available on MSDN, however it is available as a CHM download.



Represents the default map class.

Namespace: Microsoft.Maps.MapControl
Assembly: Microsoft.Maps.MapControl (in Microsoft.Maps.MapControl.dll)

public class Map : MapCore
public class Map extends MapCore
public class Map extends MapCore

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

        }
    }
}
	

System.Object
   System.Windows.DependencyObject
     System.Windows.UIElement
       System.Windows.FrameworkElement
         System.Windows.Controls.Control
           System.Windows.Controls.UserControl
             Microsoft.Maps.MapControl.Core.MapBase
               Microsoft.Maps.MapControl.Core.MapCore
                Microsoft.Maps.MapControl.Map

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Target Platforms

Show:
© 2014 Microsoft