[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Collapse]Map Control
   [Expand]Getting Started
    Layers
   [Expand]Coordinate Systems
   [Expand]Map Image Data
   [Expand]GIS Data
   [Expand]Vector Data
   [Expand]Visual Elements
   [Expand]End-User Interaction
   [Collapse]Examples
    [Collapse]General
      How to: Add a Map Control at Design Time
      How to: Add a Map Control via XAML
      How to: Add a Map Control at Runtime
      How to: Customize Navigation Elements
      How to: Add a Mini Map to the Map
      How to: Get a Bing Maps Key
    [Expand]Map Image Data
    [Expand]GIS Data
    [Expand]Vector Data
    [Expand]Printing and Exporting
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Add a Map Control at Runtime

This example demonstrates how to add a MapControl to a WPF application and connect the map to the BingMapDataProvider at runtime.

  1. Run Microsoft Visual Studio 2012, 2013, 2015, 2017 or 2019.

  2. Create a new WPF Application project or open an existing one.

  3. Open the Solution Explorer, right-click References and choose Add Reference....

    Add references to the following assemblies in the Extensions tab:

    • DevExpress.Xpf.Map.v19.2
    • DevExpress.Map.v19.2.Core
    • DevExpress.Data.v19.2

    Click OK.

  4. Handle the Window's Loaded event as follows:

    The example above uses the following entities:

    Class Description
    MapControl (see MapControl) A Map Control to display raster and vector maps. Supports both popular map services (Bing Maps and OpenStreetMap) and custom map data servers inside your corporate network.
    ImageLayer (see ImageLayer) Displays map images obtained from the map image data provider.
    BingMapDataProvider (see BingMapDataProvider) The class that loads map images from the Bing Maps data provider.
  5. Run the project to see the result.

Tip

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E3610.

Expanded See Also

Is this topic helpful?​​​​​​​