Back to Devexpress

CustomLegendItem.MarkerBrush Property

wpf-devexpress-dot-xpf-dot-charts-dot-customlegenditem-cf521a05.md

latest3.4 KB
Original Source

CustomLegendItem.MarkerBrush Property

Gets or sets the brush used to draw the custom $legend item marker.

Namespace : DevExpress.Xpf.Charts

Assembly : DevExpress.Xpf.Charts.v25.2.dll

NuGet Package : DevExpress.Wpf.Charts

Declaration

csharp
public Brush MarkerBrush { get; set; }
vb
Public Property MarkerBrush As Brush

Property Value

TypeDescription
Brush

A Brush object.

|

Example

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

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

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

Note

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.

wpf-charts-add-custom-legend-item-to-legend/CS/CustomLegendItemSample/MainWindow.xaml#L26

xml
<dxc:Legend.CustomItems>
    <dxc:CustomLegendItem MarkerBrush="#FFFF8000"
                          MarkerTemplate="{Binding Source={StaticResource markerTemplate}}"

See Also

CustomLegendItem Class

CustomLegendItem Members

DevExpress.Xpf.Charts Namespace