Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Collapse]Map Control
   [Expand]Getting Started
    Layers
   [Expand]Coordinate Systems
   [Expand]Map Image Data
   [Expand]GIS Data
   [Expand]Vector Data
   [Expand]Visual Elements
   [Collapse]Examples
    [Collapse]General
      How to: Add a Map Control at Design Time
      How to: Create a Map Control via Code
      How to: Get a Bing Maps Key
      How to: Add a Mini Map
      How to: Format Coordinates Displayed in the Navigation Panel
      How to: Show Additional Information Over the Map
    [Expand]Map Image Data
    [Expand]GIS Data
    [Expand]Vector Data
    [Expand]Printing and Exporting
   [Expand]End-User Features
   [Expand]Product Information
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Create a Map Control via Code

This example describes how to programmatically add a MapControl in a Windows Forms application and connect this control to the OpenStreetMap data provider.

  • Run MS Visual Studio.

  • Create a new Windows Forms Application project or open an existing one.

  • Open the Solution Explorer, right-click References and choose Add Reference... to add the Map Control Library.

  • In the Extensions tab, select the DevExpress.XtraMap, DevExpress.Map.Core, DevExpress.Data and DevExpress.Utils assemblies and click OK.

  • Write the following (or similar) code:

The MapControl has now been created and connected to the OpenStreetMap provider.

Run the application to see the result.

How would you rate this topic?​​​​​​​