Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ConstantLine.LegendMarkerTemplate Property

Gets or sets the template that defines the legend marker presentation for this constant line.

Namespace: DevExpress.Xpf.Charts

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

NuGet Package: DevExpress.Wpf.Charts

#Declaration

#Property Value

Type Description
DataTemplate

A DataTemplate object that contains the template for a legend marker.

#Example

This example shows how to apply the LegendMarkerTemplate property to change a constant line‘s marker at design time and runtime.

Use the following API members to create and customize a constant line:

Member Description
Axis2D.ConstantLinesInFront Provides access to the axis’ collection of constant lines that are drawn in front of series. This is a dependency property.
ConstantLine Represents a constant line of an axis.
ConstantLine.Value Gets or sets the constant line‘s position along an axis.
ConstantLine.LegendText Gets or sets the legend’s text for the constant line.
ConstantLine.LegendMarkerTemplate Gets or sets the template that defines the legend marker presentation for this constant line.
ConstantLine.LineStyle Specifies the constant line‘s style settings.
using DevExpress.Xpf.Charts;
using System.Windows;

namespace WpfApplication14 {
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window {
        public MainWindow() {
            InitializeComponent();
            XYDiagram2D diagram = ((XYDiagram2D)chartControl1.Diagram);
            diagram.ActualAxisY.ConstantLinesBehind.Add(
                new ConstantLine() {
                    Value = 4.5,
                    LegendText = "Runtime CL",
                    LegendMarkerTemplate = chartControl1.FindResource("LegendMarkerTemplate") as DataTemplate
                });
        }
    }
}
See Also