[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [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]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Collapse]Map Control
   [Expand]Getting Started
   [Expand]Coordinate Systems
   [Expand]Map Image Data
   [Expand]GIS Data
   [Expand]Vector Data
   [Expand]Visual Elements
    [Expand]Map Image Data
    [Expand]GIS Data
    [Collapse]Vector Data
     [Collapse]Providing Data
       How to: Load Data from a Shapefile
       How to: Load Data from a KML File
       How to: Load Data from a SVG File
       How to: Load Data from a SQL Geometry Datasource
       How to: Manually Generate Vector Items
       How to: Manually Generate Vector Items from WKT
       How to: Manually Generate Bubble Chart Items
       How to: Manually Generate Pie Chart Items
       How to: Automatically Generate Vector Items from a Datasource
       How to: Automatically Generate Bubble Charts Items from a Datasource
       How to: Automatically Generate Pie Charts Items from a Datasource
       How to: Provide Additional Property Values from a Data Source Using Property Mappings
       How to: Aggregate Vector Items Using a Clusterer
       How to: Implement a Custom Clusterer
     [Expand]Colorize Data
     [Expand]Customize Data Appearance
    [Expand]Printing and Exporting
   [Expand]End-User Features
   [Expand]Product Information
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst 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]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[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: Automatically Generate Vector Items from a Datasource


The complete sample project is available on GitHub.

This example illustrates how to bind a Map control to data. This data is stored in an external XML file, which contains information about wrecked ships, including ship coordinates.

In this example, the map control automatically generates ship images based on data from the datasource, along with a description for each image in a tooltip.

To accomplish this task, do the following:

  1. Create a ListSourceDataAdapter object and assign it to the VectorItemsLayer.Data property.
  2. Create a data source (in this example, this is a data table object generated by the LoadData method) and assign it to the DataSourceAdapterBase.DataSource property of the data adapter.
  3. To define names of data fields that contain information about latitude and longitude of vector items, specify appropriate values for MapItemMappingInfo.Latitude and MapItemMappingInfo.Longitude properties of the object, returned by the ListSourceDataAdapter.Mappings property.
  4. After that, define the names of other data fields that provide additional information for generated vector items. Note that these data fields values are accessible via attributes - and so you should specify attribute mapping via the DataSourceAdapterBase.AttributeMappings object.

Also, this sample illustrates how to customize tooltips using the MapItemsLayerBase.ToolTipPattern property.


If you run this sample as is, you will get a warning message saying that the specified Bing Maps key is invalid. To learn how to avoid this error, refer to the How to: Get a Bing Maps Key tutorial.

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