XYSeries2D.CrosshairLabelTemplate Property
Gets or sets the template that defines the presentation of the Crosshair Cursor’s series labels for the series. This is a dependency property.
Namespace: DevExpress.Xpf.Charts
Assembly: DevExpress.Xpf.Charts.v19.1.dll
Declaration
Property Value
Type | Description |
---|---|
DataTemplate | The Crosshair Cursor’s series label template. |
Remarks
The template uses the CrosshairSeriesLabelPresentationData class’ object as the data context.
Example
This example shows how to customize the visual representation of series crosshair labels via their template.
To accomplish this, it is necessary to create a DataTemplate object that specifies the appearance of series crosshair labels, and assign it to the XYSeries2D.CrosshairLabelTemplate
property.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-customize-the-appearance-of-series-crosshair-labels-e4071.
<Window x:Class="CrosshairLabelTemplateForXYSeries2D.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts"
Title="MainWindow" Height="350" Width="525">
<Grid>
<dxc:ChartControl>
<!--#region CrosshairOptions-->
<dxc:ChartControl.CrosshairOptions>
<dxc:CrosshairOptions ShowArgumentLine="True"
ShowValueLabels="True" ShowValueLine="True"
ShowCrosshairLabels="True" ShowArgumentLabels="True" />
</dxc:ChartControl.CrosshairOptions>
<!--#endregion CrosshairOptions-->
<dxc:XYDiagram2D >
<dxc:BarSideBySideSeries2D ColorEach="True">
<dxc:BarSideBySideSeries2D.Points>
<dxc:SeriesPoint Argument="A" Value="2" />
<dxc:SeriesPoint Argument="B" Value="3" />
<dxc:SeriesPoint Argument="C" Value="5" />
<dxc:SeriesPoint Argument="D" Value="7" />
</dxc:BarSideBySideSeries2D.Points>
<dxc:BarSideBySideSeries2D.CrosshairLabelTemplate>
<DataTemplate >
<Grid>
<Border BorderThickness="2" CornerRadius="9" >
<Border.Background>
<SolidColorBrush Color="AliceBlue" />
</Border.Background>
<Label BorderThickness="2" BorderBrush="Brown" FontStyle="Italic"
Content="{Binding Path=Text}" Padding="5,1,5,1.5"
Foreground="Red" FontSize="14"/>
</Border>
</Grid>
</DataTemplate>
</dxc:BarSideBySideSeries2D.CrosshairLabelTemplate>
</dxc:BarSideBySideSeries2D>
</dxc:XYDiagram2D>
</dxc:ChartControl>
</Grid>
</Window>
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CrosshairLabelTemplate property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.