Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

CustomLinearScaleLinePresentation.LineTemplate Property

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

Namespace: DevExpress.Xpf.Gauges

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

NuGet Package: DevExpress.Wpf.Gauges

#Declaration

public ControlTemplate LineTemplate { get; set; }

#Property Value

Type Description
ControlTemplate

A control template that specifies the scale line visual structure.

#Example

This example demonstrates how to define a custom linear scale line 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="200" Width="500">
    <Grid>
        <dxga:LinearGaugeControl>
            <dxga:LinearGaugeControl.Scales>
                <dxga:LinearScale LayoutMode="LeftToRight" ShowMinorTickmarks="False" ShowLine="True">
                    <dxga:LinearScale.LevelBars>
                        <dxga:LinearScaleLevelBar Value="50">
                            <dxga:LinearScaleLevelBar.Options>
                                <dxga:LinearScaleLevelBarOptions Offset="30"/>
                            </dxga:LinearScaleLevelBar.Options>
                        </dxga:LinearScaleLevelBar>
                    </dxga:LinearScale.LevelBars>
                    <dxga:LinearScale.LineOptions>
                        <dxga:ScaleLineOptions Thickness="40" Offset="10"/>
                    </dxga:LinearScale.LineOptions>
                    <dxga:LinearScale.TickmarksPresentation>
                        <dxga:CustomTickmarksPresentation>
                            <dxga:CustomTickmarksPresentation.MajorTickmarkTemplate>
                                <ControlTemplate>
                                    <Ellipse RenderTransformOrigin="0.5, 0.5" Width="10" Height="10" Fill="Black"/>
                                </ControlTemplate>
                            </dxga:CustomTickmarksPresentation.MajorTickmarkTemplate>
                        </dxga:CustomTickmarksPresentation>
                    </dxga:LinearScale.TickmarksPresentation>
                    <dxga:LinearScale.LinePresentation>
                        <dxga:CustomLinearScaleLinePresentation>
                            <dxga:CustomLinearScaleLinePresentation.LineTemplate>
                                <ControlTemplate>
                                    <Viewbox Stretch="Fill" Width="40">
                                        <Path Stroke="Black" StrokeThickness="0.5"  Data="M0,0 L40,5 0,10 40,15 0,20 40,25 0,30 40,35 0,40 40,45 0,50 40,55 0,60 40,65 0,70 40,75 0,80 40,85 0,90 40,95 0,100"/>
                                    </Viewbox>
                                </ControlTemplate>
                            </dxga:CustomLinearScaleLinePresentation.LineTemplate>
                        </dxga:CustomLinearScaleLinePresentation>
                    </dxga:LinearScale.LinePresentation>
                </dxga:LinearScale>
            </dxga:LinearGaugeControl.Scales>
        </dxga:LinearGaugeControl>
    </Grid>
</Window>

The image below illustrates the result.

See Also