All docs
V20.1
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
A newer version of this page is available. Switch to the current version.

MapItem.Tag Property

Gets or sets the object that contains data related to a map item.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v20.1.dll

Declaration

[DefaultValue(null)]
public object Tag { get; set; }
<DefaultValue(Nothing)>
Public Property Tag As Object

Property Value

Type Default Description
Object

null

A Object that contains information about the map item.

Remarks

Any type derived from the Object class can be assigned to this property. Use it to store data associated with a map item.

Example

The following example adds two pushpins to a map item storage. Each pushpin's Tag property is initialized with an object of the ItemInfo type. The storage's DataChanged event handler defines pushpins' visibility based on the ItemInfo.IsOpened property value.

VectorItemsLayer vectorLayer;
//...
private void Form1_Load(object sender, EventArgs e) {

    vectorLayer = new VectorItemsLayer();
    mapControl1.Layers.Add(vectorLayer);

    MapItemStorage storage = new MapItemStorage();
    vectorLayer.Data = storage;

    storage.DataChanged += Storage_DataChanged;

    MapPushpin pushpin1 = new MapPushpin();
    pushpin1.Location = new GeoPoint(48.862644, 2.336578);
    pushpin1.Tag = new ItemInfo { IsOpened = true };
    storage.Items.Add(pushpin1);

    MapPushpin pushpin2 = new MapPushpin();
    pushpin2.Location = new GeoPoint(59.9398, 30.3146);
    pushpin2.Tag = new ItemInfo { IsOpened = false };
    storage.Items.Add(pushpin2);

}

private void Storage_DataChanged(object sender, DataAdapterChangedEventArgs e) {
    foreach (MapItem item in vectorLayer.Data.Items) {
        ItemInfo info = item.Tag as ItemInfo;
        item.Visible = info.IsOpened;
    }
}

public class ItemInfo {
    public bool IsOpened { get; set; }
}
See Also