Skip to main content

Vector Items Attributes

  • 2 minutes to read

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 added to 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.

Manual creation of Vector Items

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

MapControl_VectorItemAttributes_Designer

To create an attribute:

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

<Map:MapPushpin ToolTipPattern="London">
    <Map:MapPushpin.Location>
        <Map:GeoPoint Latitude="51.507222" Longitude="-0.1275"/>
    </Map:MapPushpin.Location>
    <Map:MapPushpin.Attributes>
        <Map:MapItemAttribute Name="Name" Value="London"/>
        <Map:MapItemAttribute Name="Description" Value="London is the capital city of England and the United Kingdom."/>        
    </Map:MapPushpin.Attributes> 
</Map:MapPushpin>

Loading Vector Items from a Vector Format File

When the map control obtains vector items from a vector format file using ShapefileReader or KmlReader, vector item attributes are generated automatically. And for example, it is possible to use them in tooltips using braces to specify them.

<Map:VectorFileLayer ToolTipPattern="{}{NAME}: ${GDP_MD_EST}M">
    <Map:ShapefileReader>
        <Map:MapPackageFileSource FileName="Countries.shp"/>
    </Map:ShapefileReader>
</Map:VectorFileLayer>
See Also