Skip to main content

CustomScaleLabelPresentation.LabelTemplate Property

Gets or sets a template that configures the scale label appearance. This is a dependency property.

Namespace: DevExpress.Xpf.Gauges

Assembly: DevExpress.Xpf.Gauges.v24.1.dll

NuGet Package: DevExpress.Wpf.Gauges

Declaration

public ControlTemplate LabelTemplate { get; set; }

Property Value

Type Description
ControlTemplate

A control template that specifies the scale label visual structure.

Example

This example demonstrates how to define a custom scale labels 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 Foreground="White">
            <dxga:CircularGaugeControl.Scales>
                <dxga:ArcScale>
                    <dxga:ArcScale.Needles>
                        <dxga:ArcScaleNeedle/>
                    </dxga:ArcScale.Needles>
                    <dxga:ArcScale.LabelOptions>
                        <dxga:ArcScaleLabelOptions Orientation="Tangent" Offset="-14"/>
                    </dxga:ArcScale.LabelOptions>
                    <dxga:ArcScale.LabelPresentation>
                        <dxga:CustomScaleLabelPresentation>
                            <dxga:CustomScaleLabelPresentation.LabelTemplate>
                                <ControlTemplate>
                                    <Border RenderTransformOrigin="0.5,0.5" Padding="10,2" CornerRadius="9" Background="Red" BorderThickness="1" BorderBrush="Black">
                                        <TextBlock Text="{Binding Text}"/>
                                    </Border>
                                </ControlTemplate>
                            </dxga:CustomScaleLabelPresentation.LabelTemplate>
                        </dxga:CustomScaleLabelPresentation>
                    </dxga:ArcScale.LabelPresentation>
                </dxga:ArcScale>
            </dxga:CircularGaugeControl.Scales>
        </dxga:CircularGaugeControl>
    </Grid>
</Window>

The image below illustrates the result.

See Also