[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
   [Collapse]Vector Data
    [Collapse]Providing Data
     [Expand]Add Vector Items Manually
     [Expand]Load Vector Items from Vector Format Source
      Generate Vector Items Automatically
      Generate Chart Items Automatically
      Provide Data Using Vector Item Attributes
   [Expand]Visual Elements
   [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)

Provide Data Using Vector Item Attributes

Attributes are used to associate a Vector Item with supplementary information. The Map Control operates with vector item attributes, allowing you to visualize any kind of data.

A single attribute is represented by the MapItemAttribute object. This object can be accessed as an item of the MapItemAttributeCollection, returned by the MapItem.Attributes property of the MapItem class descendant.

These attributes can be specified in various ways, depending on the approach the Map Control utilizes to obtain vector items. The sections below describe each approach in detail, as well as how to use vector item attributes.

Expanded Manual Creation of Vector Items

When vector items are created manually, you can also specify the attributes for any vector item.

To create an attribute:

The following code shows how this can be done for the Map Polygon.

Expanded Loading Vector Items from a Shapefile

When the map control obtains vector items from a vector formatted file using ShapefileDataAdapter, KmlFileDataAdapter or SqlGeometryDataAdapter, vector item attributes are generated automatically.

The following code demonstrates how to load data from a Shapefile.

In this case, you have the capability to select attributes to be used by the Map Control to visualize supplementary data. For example, the code snippet below shows how to display Name, Year and Desc attributes in tooltips for vector items.

Expanded Loading Vector Items from a Datasource

If the Map Control obtains vector items from a datasource, the attributes are created by mapping datasource fields to vector item attributes.

As a result of vector item mapping, the map control specifies which data field from the data source will be bound to which data member (DataSourceAdapterBase.DataMember) of the DataSourceAdapterBase class descendant object. This object can be accessed using the VectorItemsLayer.Data property.

To create vector item attributes, do the following:

The code below shows how to create Name, Year and Desc attributes, and add them to the map item attribute mapping collection.

Expanded Using Vector Item Attributes

There are different ways to use vector item attributes in your application.

The most popular use of vector item attributes is when showing vector data from a datasource in tooltips. To learn how this can be done, see the How to: Automatically Generate Vector Items from a Datasource example.

Another example is to color shape contours depending on data associated with a shape. To do this, use the Map Colorizer. See the How to: Colorize Manually Added Shapes Using the Choropleth Colorizer example to learn more.

Expanded See Also

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