windowsforms-devexpress-dot-xtramap-dot-mapcontrol-631992d9.md
Occurs when items are being created for the legend.
Namespace : DevExpress.XtraMap
Assembly : DevExpress.XtraMap.v25.2.dll
NuGet Package : DevExpress.Win.Map
public event LegendItemCreatingEventHandler LegendItemCreating
Public Event LegendItemCreating As LegendItemCreatingEventHandler
The LegendItemCreating event's data class is LegendItemCreatingEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Index | Returns the index of the legend item being created. |
| Item | Returns the legend item being created. |
| Legend | Provides access to the legend for which a new item has been created. |
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.
void map_LegendItemCreating(object sender, LegendItemCreatingEventArgs e) {
e.Item.Text = String.Format("{0}$", e.Item.Value);
}
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