This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IL > ILegendItem Interface (ArcObjects .NET 10.5 SDK) |
Provides access to members that control how a layer appears in a legend. Can be stored in a style. Note: the ILegendItem interface has been superseded byILegendItem3. Please consider using the more recent version.
Description | ||
---|---|---|
CanDisplay | Indicates if the style is compatible with the specified layer. | |
Columns | Number of columns in the legend item. | |
CreateGraphics | Rebuilds the list of graphics. Call whenever the associated layer changes. | |
Graphics | List of graphics that represent the legend item. Must call CreateGraphics first. | |
GroupIndex | Zero-based index of the legend group shown by this item. Use -1 to show all legend groups using this item. | |
HeadingSymbol | Text symbol used to draw the heading. | |
Height | Height of the item in points. Must call CreateGraphics first. | |
KeepTogether | Indicates if classes must appear in a single column or whether they can be split across multiple columns. | |
Layer | Associated layer. | |
LayerNameSymbol | Text symbol used to draw the layer name. | |
LegendClassFormat | Default formatting information for the legend classes. Renderer may override. | |
Name | Name of the style. | |
NewColumn | Indicates if the item starts a new column in the legend. | |
ShowDescriptions | Indicates if descriptions are visible. | |
ShowHeading | Indicates if heading is visibile. | |
ShowLabels | Indicates if labels are visible. | |
ShowLayerName | Indicates if layer name is visibile. | |
Width | Width of the item in points. Must call CreateGraphics first. |
CoClasses and Classes | Description |
---|---|
HorizontalBarLegendItem | Horizontal bar legend item. |
HorizontalLegendItem | Horizontal legend item. |
NestedLegendItem | Nested legend item. |
VerticalLegendItem | Vertical legend item. |
The Legend can be seen as a collection of map layers each layer being represented by a LegendItem.
The ILegendItem interface controls all the properties of a legend item:
CanDisplay will be true if the type of the LegendItem is compatible with the rendering of the layer. NestedLegendItem for instance, cannot be used by all renderers.
The Layer property returns the layer this LegendItem is associated with
Columns is the number of columns it should span. Height and Width control the size of the legend item.
ILegendItem also gives access to the graphic elements used to draw the legend item - Graphics property - to the symbols specific to this legend item - HeadingSymbol, LayerNameSymbol - and to the legend items LegendClassFormat object.
NewColumn controls whether the LegendItem should be displayed starting a new column. KeepTogether indicates if it can be split over different columns. A number of properties control whether the label, description, heading, and layer name should be displayed.
Horizontal and Vertical legend items use the esriLegendItemArrangement enumeration which can be set with IHorizontalLegendItem::Arrangement and IVerticalLegendItem::Arrangement to specify the position of the label, patch, and description. The default is esriPatchLabelDescription, which translates to the patch on the far left, label to the right of the patch, then the description, if available, on the far right.
There are currently four types of legend items: HorizontalLegendItem, VerticalLegendItem, HorizontalBarLegendItem, and NestedLegendItem with corresponding interfaces.
Horizontal legend items are the default and most commonly used class of legend items.