CrosshairAxisLabelOptions.Pattern Property

Gets or sets a string which represents the pattern specifying the text to be displayed within the crosshair axis label that appears for a series point.

Namespace: DevExpress.Xpf.Charts

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


public string Pattern { get; set; }

Property Value

Type Description

A String that is the crosshair axis label pattern. The default value is Empty.

Property Paths

You can access this nested property as listed below:

Object Type Path to Pattern


You can use either the {A} pattern for the X-axis, or the {V} pattern for the Y-axis, together with the format specifiers.

For example, the table below shows {V:F0} and {V:F4} patterns that are used to format crosshair value labels.

Pattern= {V:F0} Pattern= {V:F4}
CrosshairAxisLabelPatternVF0 CrosshairAxisLabelPatternVF4

The table below demonstrates the {A:F0} and {A:F4} patterns that format crosshair argument labels.

Pattern= {A:F0} Pattern= {A:F4}
CrosshairAxisLabelPatternAF0 CrosshairAxisLabelPatternAF4


When you format crosshair axis labels, they can demand more space on a diagram to display the whole axis value. To extend the space for a crosshair axis label, the AxisLabel.BeginText property should contain empty spaces that correspond the required area for the crosshair axis labels.

You can use standard and custom format specifics, together with the placeholders to format numeric and date/time values (e.g., {V:F0}). To learn more, see the Format Specifiers topic.

For more information on how to use a crosshair cursor, refer to the Tooltip and Crosshair Cursor topic.


This example demonstrates how to change the text displayed in crosshair labels.

To do this, use the CrosshairAxisLabelOptions.Pattern, XYSeries2D.CrosshairLabelPattern, and CrosshairOptions.GroupHeaderPattern properties.

In addition, standard and custom format specifiers are used together with the placeholders to format numeric and date/time values (e.g., {A:F0}). To learn more, see the Format Specifiers topic.

See the Crosshair Cursor topic to learn more on a crosshair cursor.

View Example

<Window x:Class="UsingCrosshairLabelPattern.MainWindow"
        Title="MainWindow" Height="350" Width="525">
            <!--region #GroupHeaderPattern-->
                <dxc:CrosshairOptions  GroupHeaderPattern="Year: {A}" 
                                       ShowArgumentLabels="True" ShowArgumentLine="True" 
                                       ShowValueLabels="True" ShowValueLine="True">
            <!--endregion #GroupHeaderPattern-->
                    <!--region #CrosshairAxisLabelPattern-->
                                <dxc:CrosshairAxisLabelOptions Pattern="Year: {A:F0}" />
                    <!--endregion #CrosshairAxisLabelPattern-->

                    <!--region #CrosshairLabelPattern-->
                        <dxc:LineSeries2D DisplayName="Europe" 
                                          CrosshairLabelPattern="{}{S} population: {V}">
                                <dxc:SeriesPoint Argument="1950" Value="546" />
                                <dxc:SeriesPoint Argument="1960" Value="605" />
                                <dxc:SeriesPoint Argument="1970" Value="656" />
                                <dxc:SeriesPoint Argument="1980" Value="694" />
                                <dxc:SeriesPoint Argument="1990" Value="721" />
                                <dxc:SeriesPoint Argument="2000" Value="730" />
                                <dxc:SeriesPoint Argument="2010" Value="728" />
                                <dxc:SeriesPoint Argument="2020" Value="721" />
                                <dxc:SeriesPoint Argument="2030" Value="704" />
                                <dxc:SeriesPoint Argument="2040" Value="680" />
                                <dxc:SeriesPoint Argument="2050" Value="650" />
                        <dxc:LineSeries2D  DisplayName="Americas" 
                                           CrosshairLabelPattern="{}{S} population: {V} ">
                                <dxc:SeriesPoint Argument="1950" Value="332" />
                                <dxc:SeriesPoint Argument="1960" Value="417" />
                                <dxc:SeriesPoint Argument="1970" Value="513" />
                                <dxc:SeriesPoint Argument="1980" Value="614" />
                                <dxc:SeriesPoint Argument="1990" Value="721" />
                                <dxc:SeriesPoint Argument="2000" Value="836" />
                                <dxc:SeriesPoint Argument="2010" Value="935" />
                                <dxc:SeriesPoint Argument="2020" Value="1027" />
                                <dxc:SeriesPoint Argument="2030" Value="1110" />
                                <dxc:SeriesPoint Argument="2040" Value="1178" />
                                <dxc:SeriesPoint Argument="2050" Value="1231" />
                    <!--endregion #CrosshairLabelPattern-->
See Also