Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ColorLegendItem Class

An item that stores information about the color and description of the ColorLegendBase class descendants.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v24.2.dll

NuGet Package: DevExpress.Win.Map

#Declaration

public class ColorLegendItem :
    MapLegendItemBase,
    IColorLegendItem,
    ILegendItem

#Example

This example shows how to use images in a map legend.

The following symbols are used in the example:

ColorListLegend.ImageList

Gets or sets the source of images to be displayed within a legend.

ColorListLegend.CustomItems

Provides access to the collection of custom legend items.

ColorLegendItem

An item that stores information about the color and description of the ColorLegendBase class descendants.

ColorLegendItem.ImageIndex

Gets or sets the index of an image used by this legend item.

// In the Form's constructor.
//Create a Legend containing images.
ColorListLegend legend = new ColorListLegend();
legend.ImageList = map.ImageList;
legend.CustomItems.Add(
    new ColorLegendItem {
        ImageIndex = 0,
        Text = "Shipwreck"
    });
map.Legends.Add(legend);

#Inheritance

See Also