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.v20.1.dll

Declaration

public DataTemplate LegendMarkerTemplate { get; set; }
Public Property LegendMarkerTemplate As DataTemplate

Property Value

Type Description
DataTemplate

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

Examples

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.
<Window x:Class="WpfApplication14.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" 
        xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts">
    <Grid>
        <dxc:ChartControl Name="chartControl1">
            <dxc:ChartControl.Resources>
                <DataTemplate x:Key="LegendMarkerTemplate">
                    <Border BorderThickness="1" 
                            BorderBrush="{Binding Path=MarkerLineBrush}">
                        <Path x:Name = "MarkerPath"
                              Stretch="Fill"
                              Fill="{Binding Path=MarkerBrush}"
                              Stroke="{Binding Path=MarkerLineBrush}"
                              StrokeThickness="{Binding Path=MarkerLineStyle.Thickness}"
                              StrokeDashArray="{Binding Path=MarkerLineStyle.DashStyle.Dashes}"
                              StrokeDashOffset="{Binding Path=MarkerLineStyle.DashStyle.Offset}"
                              StrokeDashCap="{Binding Path=MarkerLineStyle.DashCap}"
                              StrokeLineJoin="{Binding Path=MarkerLineStyle.LineJoin}"
                              StrokeMiterLimit="{Binding Path=MarkerLineStyle.MiterLimit}"
                              SnapsToDevicePixels="True"
                              StrokeStartLineCap="Square"
                              StrokeEndLineCap="Square">
                            <Path.Data>
                                <LineGeometry StartPoint="0,0" EndPoint="10,0"/>
                            </Path.Data>
                        </Path>
                    </Border>
                </DataTemplate>
            </dxc:ChartControl.Resources>
            <dxc:ChartControl.Legends>
                <dxc:Legend/>
            </dxc:ChartControl.Legends>
            <dxc:ChartControl.Diagram>
                <dxc:XYDiagram2D>
                    <dxc:XYDiagram2D.AxisY>
                        <dxc:AxisY2D>
                            <dxc:AxisY2D.ConstantLinesInFront>
                                <dxc:ConstantLine Value="0.5" Brush="Green" 
                                                  LegendText="Design time CL" 
                                                  LegendMarkerTemplate="{StaticResource LegendMarkerTemplate}">
                                    <dxc:ConstantLine.LineStyle>
                                        <dxc:LineStyle Thickness="2" >
                                            <dxc:LineStyle.DashStyle>
                                                <DashStyle Dashes="2 2" />
                                            </dxc:LineStyle.DashStyle>
                                        </dxc:LineStyle>
                                    </dxc:ConstantLine.LineStyle>
                                </dxc:ConstantLine>
                            </dxc:AxisY2D.ConstantLinesInFront>
                        </dxc:AxisY2D>
                    </dxc:XYDiagram2D.AxisY>
                    <dxc:XYDiagram2D.Series>
                        <dxc:LineSeries2D DisplayName="Series" 
                                          MarkerVisible="True" 
                                          ShowInLegend="False">
                            <dxc:LineSeries2D.Points>
                                <dxc:SeriesPoint Argument="A" Value="3" />
                                <dxc:SeriesPoint Argument="B" Value="2" />
                                <dxc:SeriesPoint Argument="C" Value="3" />
                                <dxc:SeriesPoint Argument="D" Value="5" />
                            </dxc:LineSeries2D.Points>
                        </dxc:LineSeries2D>
                    </dxc:XYDiagram2D.Series>
                </dxc:XYDiagram2D>
            </dxc:ChartControl.Diagram>
        </dxc:ChartControl>
    </Grid>
</Window>
See Also