Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CustomizeLegendEventArgs.LegendItems Property

.NET Framework (current version)

Used to remove, modify or change the order of both custom and default legend items in the CustomizeLegend event. Can also be used to add custom legend items.

Namespace:   System.Windows.Forms.DataVisualization.Charting
Assembly:  System.Windows.Forms.DataVisualization (in System.Windows.Forms.DataVisualization.dll)

public LegendItemsCollection LegendItems { get; }

The LegendItems property allows you to delete or modify both default and custom legend items in the CustomizeLegend event, and to add custom legend items. The order of legend items can also be changed.


The SeriesPointIndex and LegendItem.SeriesPointIndex properties can be used to determine the data element that is associated with a default legend item. These properties will return zero-length strings for custom legend items, because custom items are not associated with chart data.

This property enables you to determine which Legend the event was raised for, which enables you to customize an individual Legend.

.NET Framework
Available since 4.0
Return to top
© 2017 Microsoft