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

CustomDrawCrosshairEventArgs Class

Provides data for a chart control’s ChartControl.CustomDrawCrosshair event.

Namespace: DevExpress.Xpf.Charts

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

NuGet Packages: DevExpress.WindowsDesktop.Wpf.Charts, DevExpress.Wpf.Charts

Declaration

[NonCategorized]
public class CustomDrawCrosshairEventArgs :
    RoutedEventArgs

Remarks

The CustomDrawCrosshairEventArgs class represents an argument for the ChartControl.CustomDrawCrosshair event of a chart control.

An instance of the CustomDrawCrosshairEventArgs class with appropriate settings is automatically created and passed to the corresponding event’s handler.

Example

This example shows how to provide a custom appearance for the crosshair cursor using the ChartControl.CustomDrawCrosshair event. This event is invoked when you click the Custom Draw Crosshair Cursor button on the form.

If you wish to display crosshair axis lines and labels on a chart before custom drawing the crosshair cursor, set the CrosshairOptions.ShowArgumentLabels, CrosshairOptions.ShowArgumentLine, CrosshairOptions.ShowValueLabels and CrosshairOptionsBase.ShowValueLine properties to true.

Note that the customization of the crosshair cursor is provided for the CrosshairOptions.SnapMode property set to NearestArgument.

View Example

<Window x:Class="CrosshairCustomDraw.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>
        <StackPanel>
            <dxc:ChartControl Height="269"  Name="chartControl1" CustomDrawCrosshair="chartControl1_CustomDrawCrosshair">
                <dxc:ChartControl.CrosshairOptions>
                    <dxc:CrosshairOptions ShowArgumentLabels="True" ShowArgumentLine="True" 
                        ShowValueLabels="True" ShowValueLine="True"/>
                </dxc:ChartControl.CrosshairOptions>
                <dxc:XYDiagram2D>
                <dxc:LineSeries2D DisplayName="Series1">
                    <dxc:SeriesPoint Argument="1" Value="50"/>
                    <dxc:SeriesPoint Argument="2" Value="44"/>
                    <dxc:SeriesPoint Argument="3" Value="55"/>
                    <dxc:SeriesPoint Argument="4" Value="77"/>
                </dxc:LineSeries2D>
                <dxc:LineSeries2D DisplayName="Series2">
                    <dxc:SeriesPoint Argument="1" Value="22"/>
                    <dxc:SeriesPoint Argument="2" Value="11"/>
                    <dxc:SeriesPoint Argument="3" Value="9"/>
                    <dxc:SeriesPoint Argument="4" Value="8"/>
                </dxc:LineSeries2D>
                </dxc:XYDiagram2D>
            </dxc:ChartControl>
            <Button Height="35" Content="Custom Draw Crosshair Cursor" Click="Button_Click"></Button>
        </StackPanel>
    </Grid>
</Window>

Inheritance

Object
EventArgs
RoutedEventArgs
CustomDrawCrosshairEventArgs
See Also