CustomArcScaleNeedlePresentation.NeedleTemplate Property
Gets or sets a template that configures the needle appearance. This is a dependency property.
Namespace: DevExpress.Xpf.Gauges
Assembly: DevExpress.Xpf.Gauges.v24.2.dll
NuGet Package: DevExpress.Wpf.Gauges
Declaration
Property Value
Type | Description |
---|---|
ControlTemplate | A control template that specifies the needle visual structure. |
Example
This example demonstrates how to define a custom needle presentation.
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:GaugesDemoApp"
xmlns:dxga="http://schemas.devexpress.com/winfx/2008/xaml/gauges"
x:Class="GaugesDemoApp.MainWindow"
Title="MainWindow" Height="300" Width="300">
<Grid>
<dxga:CircularGaugeControl>
<dxga:CircularGaugeControl.Scales>
<dxga:ArcScale ShowMinorTickmarks="False" ShowLine="True">
<dxga:ArcScale.Needles>
<dxga:ArcScaleNeedle Value="85" IsInteractive="True">
<dxga:ArcScaleNeedle.Presentation>
<dxga:CustomArcScaleNeedlePresentation>
<dxga:CustomArcScaleNeedlePresentation.NeedleTemplate>
<ControlTemplate>
<Grid RenderTransformOrigin="0, 0.5" Margin="0,0,2,0" Height="24" Opacity="0.5">
<Path HorizontalAlignment="Right" Fill="Black" Height="17" Width="20" VerticalAlignment="Center"
Data="M0,0 L20,8 L0,16 z"/>
<Rectangle Fill="Black" Height="8" VerticalAlignment="Center" Margin="0,0,20,0"/>
<Rectangle Fill="Black" Height="8" Width="30" HorizontalAlignment="Left" Margin="-30,0,0,0"/>
<Path Fill="Black" Margin="-50,0,0,0" VerticalAlignment="Center" Width="30" Height="17" HorizontalAlignment="Left"
Data="M0,0 L20,0 L30,8 L20,17 L0,17 L10,8 L0,0 z"/>
<Ellipse StrokeThickness="0" Fill="Red" HorizontalAlignment="Left" Margin="-10,0,0,0" Width="20" VerticalAlignment="Center" Height="20"/>
</Grid>
</ControlTemplate>
</dxga:CustomArcScaleNeedlePresentation.NeedleTemplate>
</dxga:CustomArcScaleNeedlePresentation>
</dxga:ArcScaleNeedle.Presentation>
</dxga:ArcScaleNeedle>
</dxga:ArcScale.Needles>
</dxga:ArcScale>
</dxga:CircularGaugeControl.Scales>
</dxga:CircularGaugeControl>
</Grid>
</Window>
The image below illustrates the result.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the NeedleTemplate 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.