Back to Devexpress

MapItemsLayerBase.ItemImageIndex Property

windowsforms-devexpress-dot-xtramap-dot-mapitemslayerbase-cc70df17.md

latest3.5 KB
Original Source

MapItemsLayerBase.ItemImageIndex Property

Gets or sets the index of the image assigned to the map item.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
[DefaultValue(-1)]
public int ItemImageIndex { get; set; }
vb
<DefaultValue(-1)>
Public Property ItemImageIndex As Integer

Property Value

TypeDefaultDescription
Int32-1

An integer which specifies the index of the map item’s image in a collection of images.

|

Remarks

Use the MapControl.ImageList property to store images to be displayed in the map.

For information on how to show images on the map, refer to the following help topic: Generate Vector Items Automatically.

Example

View Example

csharp
mapControl.Layers.Add(CreateVectorLayer(data));
LayerBase CreateVectorLayer(object data) {
    ListSourceDataAdapter adapter = new ListSourceDataAdapter() {
        DataSource = data,
        DefaultMapItemType = MapItemType.Custom
    };
    adapter.Mappings.Latitude = "Latitude";
    adapter.Mappings.Longitude = "Longitude";

    adapter.AttributeMappings.Add(new MapItemAttributeMapping() {Name = "Name", Member = "Name"});
    adapter.AttributeMappings.Add(new MapItemAttributeMapping() {Name = "Year", Member = "Year"});
    adapter.AttributeMappings.Add(new MapItemAttributeMapping() {Name = "Description", Member = "Description"});

    VectorItemsLayer layer = new VectorItemsLayer() {
        Data = adapter,
        ItemImageIndex = 0,
        EnableSelection = false,
        EnableHighlighting = false,
        ToolTipPattern = "<b>{Name} ({Year})</b>\n{Description}"
    };
    return layer;
}
vb
mapControl.Layers.Add(CreateVectorLayer(data))
Private Function CreateVectorLayer(ByVal data As Object) As LayerBase
    Dim adapter As New ListSourceDataAdapter() With {.DataSource = data, .DefaultMapItemType = MapItemType.Custom}
    adapter.Mappings.Latitude = "Latitude"
    adapter.Mappings.Longitude = "Longitude"

    adapter.AttributeMappings.Add(New MapItemAttributeMapping() With {.Name = "Name", .Member = "Name"})
    adapter.AttributeMappings.Add(New MapItemAttributeMapping() With {.Name = "Year", .Member = "Year"})
    adapter.AttributeMappings.Add(New MapItemAttributeMapping() With {.Name = "Description", .Member = "Description"})

    Dim layer As New VectorItemsLayer() With {.Data = adapter, .ItemImageIndex = 0, .EnableSelection = False, .EnableHighlighting = False, .ToolTipPattern = "<b>{Name} ({Year})</b>" & ControlChars.Lf & "{Description}"}
    Return layer
End Function

See Also

MapItemsLayerBase Class

MapItemsLayerBase Members

DevExpress.XtraMap Namespace