Skip to main content

How to: Add a Map Control via XAML

This is a short introductory example, which describes how to add a Map Control to your WPF application in a XAML designer.

  • Run Microsoft Visual Studio.
  • Create a new WPF 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 the DevExpress.Xpf.Map.v24.1 assembly and click it.

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

    Repeat this step to add the DevExpress.Data.v24.1 and DevExpress.Map.v24.1.Core references.

    Click OK to apply changes and close the window.

  • Switch to the XAML designer. And add a Map control to the window.
  • The XAML should look like following. If it does not, overwrite XAML with the following.

    <Window x:Class="DXMapExample.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:dxm="http://schemas.devexpress.com/winfx/2008/xaml/map"
            Title="MainWindow" Height="350" Width="525" >
        <Grid>
            <dxm:MapControl Name="mapControl1" />
        </Grid>
    </Window>
    

That’s all - the MapControl has been added to your application.

See Also