Back to Devexpress

MapControl.LegendItemCreating Event

windowsforms-devexpress-dot-xtramap-dot-mapcontrol-631992d9.md

latest2.2 KB
Original Source

MapControl.LegendItemCreating Event

Occurs when items are being created for the legend.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
public event LegendItemCreatingEventHandler LegendItemCreating
vb
Public Event LegendItemCreating As LegendItemCreatingEventHandler

Event Data

The LegendItemCreating event's data class is LegendItemCreatingEventArgs. The following properties provide information specific to this event:

PropertyDescription
IndexReturns the index of the legend item being created.
ItemReturns the legend item being created.
LegendProvides access to the legend for which a new item has been created.

Example

To manually customize legend items, implement the MapControl.LegendItemCreating event handler, where you can configure MapLegendItemBase descendant class objects as you wish.

The following instance demonstrates how to do this.

csharp
void map_LegendItemCreating(object sender, LegendItemCreatingEventArgs e) {
    e.Item.Text = String.Format("{0}$", e.Item.Value);
}
vb
Private Sub map_LegendItemCreating(ByVal sender As Object, ByVal e As LegendItemCreatingEventArgs)
    e.Item.Text = String.Format("{0}$", e.Item.Value)
End Sub

See Also

MapControl Class

MapControl Members

DevExpress.XtraMap Namespace