Skip to main content

How to: Add a Map Control via XAML

This brief introductory example describes how to add a Map Control to your Silverlight application in a XAML designer.

  • Run the Microsoft Visual Studio 2010, 2012 or 2013.
  • Create a new Silverlight Application project or open an existing one.
  • Open the Solution Explorer, right-click References and choose Add Reference... to add the Map Control library.

    how-to-add-map-control-xaml-1

  • Then, locate and click the DevExpress.Xpf.Map assembly in the Extensions tab.

    how-to-add-map-control-xaml-2

    Repeat the same actions for the DexExpress.Data and DevExpress.Map.Core assemblies.

    Click OK.

  • Switch to the XAML designer.
  • Overwrite your XAML with the following.

    
    <UserControl x:Class="XpfMapApplication.MainPage"
        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:dxm="http://schemas.devexpress.com/winfx/2008/xaml/map"
        mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="400" >
    
        <Grid x:Name="LayoutRoot" Background="White">
            <dxm:MapControl />
        </Grid>
    </UserControl>
    

Your MapControl has now been added to your application.