Skip to main content

How to: Add a Map Control via Code

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

  • Run MS Visual Studio 2017.
  • Create a new Windows Store | Blank App (XAML) project or open an existing one.
  • Open the Solution Explorer, right-click References and choose Add Reference… to add the Map Control Library.

    Examples_AddUsingXaml-01

  • Then, locate the DevExpress.Visualization assembly and click it.

    Examples_AddUsingXaml-02

    Repeat this step to add the DevExpress.Core reference.

    Click OK to apply changes and close the window.

  • Write the following (or similar) code.

    using DevExpress.UI.Xaml.Map;
    using Windows.UI.Xaml.Controls;
    
    namespace App2
    {
        public sealed partial class MainPage : Page
        {
            public MainPage()
            {
                this.InitializeComponent();
                MapControl map = new MapControl();
                this.Content = map;
            }
        }
    }
    

The MapControl has been added to your application now.