Skip to main content

CustomLegendItem Class

An individual custom legend item.

Namespace: DevExpress.Xpf.Charts

Assembly: DevExpress.Xpf.Charts.v23.1.dll

NuGet Package: DevExpress.Wpf.Charts


public class CustomLegendItem :

The following members return CustomLegendItem objects:


The CustomLegendItem class contains the settings that define the functionality of a custom item within a legend.

In addition to the settings inherited from the base ChartElement class, the CustomLegendItem class implements properties that allow you to specify the text used to display an item (the CustomLegendItem.Text property), brush (CustomLegendItem.MarkerBrush) and data template (CustomLegendItem.MarkerTemplate) used to display an item’s marker and control the item elements visibility (Visibility).

Custom items associated with a particular legend are contained within the LegendBase.CustomItems collection which is represented by an object of the CustomLegendItemCollection class. A particular CustomLegendItem object can be accessed in the collection using either indexer notation.


To add a custom legend item to a legend, create a new instance of the CustomLegendItem class and add it to the LegendBase.CustomItems collection. Then, configure the custom item, for example, using the CustomLegendItem.Text property to set the item’s text and the CustomLegendItem.MarkerTemplate property to set the item’s marker.

View Example

    <DataTemplate x:Key="markerTemplate">
        <Image Source="Images/DXLogo.png"/>
            <dxc:Legend ItemVisibilityMode="AutoGeneratedAndCustom">
                    <dxc:CustomLegendItem MarkerBrush="#FFFF8000" 
                                          MarkerTemplate="{Binding Source={StaticResource markerTemplate}}" 
                                          Text="Powered by DevExpress"/>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CustomLegendItem class.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.



Show 11 items
See Also