Back to Devexpress

MapItem.Attributes Property

windowsforms-devexpress-dot-xtramap-dot-mapitem-b3bf518d.md

latest3.2 KB
Original Source

MapItem.Attributes Property

Gets the attributes for this map item.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
public MapItemAttributeCollection Attributes { get; }
vb
Public ReadOnly Property Attributes As MapItemAttributeCollection

Property Value

TypeDescription
MapItemAttributeCollection

A MapItemAttributeCollection object.

|

Remarks

Attributes are used to associate a vector item with supplementary information. A vector item is represented by the MapItemAttribute object. This object can be accessed as an item of the MapItemAttributeCollection object returned by the MapItem.Attributes property of the MapItem class descendant.

For more information on map item attributes, see Provide Data Using Vector Item Attributes.

Example

csharp
private MapPolygon CreatePolygon(double areaValue, string polygonName, GeoPoint[] points) {
    MapPolygon item = new MapPolygon();

    item.Attributes.Add(new MapItemAttribute() {
        Name = areaValueAttrName,
        Type = typeof(double),
        Value = areaValue
    });
    item.Attributes.Add(new MapItemAttribute() {
        Name = polygonNameAttrName,
        Type = typeof(string),
        Value = polygonName
    });

    item.ToolTipPattern = "{" + polygonNameAttrName + "}=<b>{" + areaValueAttrName + "}</b>";

    foreach (GeoPoint point in points) {
        item.Points.Add(point);
    }

    return item;
}
vb
Private Function CreatePolygon(ByVal areaValue As Double, ByVal polygonName As String, ByVal points() As GeoPoint) As MapPolygon
    Dim item As New MapPolygon()

    item.Attributes.Add(New MapItemAttribute() With {.Name = areaValueAttrName, .Type = GetType(Double), .Value = areaValue})
    item.Attributes.Add(New MapItemAttribute() With {.Name = polygonNameAttrName, .Type = GetType(String), .Value = polygonName})

    item.ToolTipPattern = "{" & polygonNameAttrName & "}=<b>{" & areaValueAttrName & "}</b>"

    For Each point As GeoPoint In points
        item.Points.Add(point)
    Next point

    Return item
End Function

See Also

MapItem Class

MapItem Members

DevExpress.XtraMap Namespace