Skip to main content
A newer version of this page is available. .

CrosshairOptions.ContentShowMode Property

Gets or sets the element that displays the Crosshair’s content.

Namespace: DevExpress.Xpf.Charts

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

Declaration

public CrosshairContentShowMode ContentShowMode { get; set; }

Property Value

Type Description
CrosshairContentShowMode

The value that specifies the chart element displaying the Crosshair’s content.

Available values:

Name Description
Default

The default mode.

Label

The Crosshair’s label displays information about the series point that the Crosshair Cursor highlights.

crosshair-content-show-mode-label

Legend

A legend displays information about the series point that the Crosshair Cursor highlights.

crosshair-content-show-mode-legend

Property Paths

You can access this nested property as listed below:

Object Type Path to ContentShowMode
ChartControl
.CrosshairOptions.ContentShowMode

Example

This example demonstrates how to modify the Crosshair Cursor’s appearance using the ChartControl.CustomDrawCrosshair event.

In this sample, crosshair content is displayed in a legend. For this, set the CrosshairOptions.ContentShowMode to the Legend value that the CrosshairContentShowMode enumeration contains. Note that you can specify the crosshair’s content show mode for the specified series using the XYSeries2D.CrosshairContentShowMode property.

Use the CustomDrawCrosshairEventArgs.CrosshairLegendElements property to obtain the crosshair legend elements’ collection.

To customize each crosshair legend element options, use the CrosshairLegendElement class properties.

using System.Windows;
using System.Windows.Media;
using DevExpress.Xpf.Charts;
namespace CustomDrawCrosshair {
    public partial class MainWindow : Window {
        const int ColorSelectorValue = 10;
        public MainWindow() {
            InitializeComponent();
        }
        private void OnCustomDrawCrosshair(object sender, CustomDrawCrosshairEventArgs e) {
            foreach(CrosshairLegendElement legendElement in e.CrosshairLegendElements) {
                legendElement.Foreground = (legendElement.SeriesPoint.Value > ColorSelectorValue) ? Brushes.Green : Brushes.Red;
                legendElement.LineElement.Brush = legendElement.Foreground;
                legendElement.AxisLabelElement.Background = legendElement.Foreground;
            }            
        }
    }
}
See Also