Legend.CustomItemsSource Property

Gets or sets the collection of objects used to generate custom legend items.

Namespace: DevExpress.Xpf.Charts

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


public IEnumerable CustomItemsSource { get; set; }

Property Value

Type Description

A collection that is used to generate custom legend items. The default is null (Nothing in Visual Basic).


The following example generates custom legend items based on a collection of data objects:

    <local:ChartViewModel />
        <dxc:Legend x:Name="legend" 
                    CustomItemsSource="{Binding Path=CustomLegendItems}">
                    <dxc:CustomLegendItem Text="{Binding Path=Text}" 
                                          MarkerBrush="{Binding Path=Brush}"/>
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows.Media;

namespace DxSample {
    public class ChartViewModel {
        public ObservableCollection<LegendItem> CustomLegendItems { get; set; }
        public ChartViewModel() {
            CustomLegendItems = new ObservableCollection<LegendItem>();
            CustomLegendItems.Add(new LegendItem { Text = "Custom Item 1", Brush = Brushes.Red });
            CustomLegendItems.Add(new LegendItem { Text = "Custom Item 2", Brush = Brushes.Green });

    public class LegendItem {
        public string Text { get; set; }
        public Brush Brush { get; set; }
See Also