ScaleCustomElement Class
A custom element on a scale.
Namespace: DevExpress.Xpf.Gauges
Assembly: DevExpress.Xpf.Gauges.v24.2.dll
NuGet Package: DevExpress.Wpf.Gauges
Declaration
Remarks
This custom element is used to add any control to the gauge scale. It is represented by an instance of the ScaleCustomElement class and can be accessed as an item of the ScaleCustomElementCollection object returned by the Scale.CustomElements property.
Example
This example illustrates how to add two buttons as custom elements to the linear scale and use them to increase or decrease the current scale value.
For this, create two ScaleCustomElement
objects and add a button control to each custom element.
Finally, to provide the capability for end-users to change the scale’s value, handle the button1_Click and button2_Click events and write code that will increment and decrement the scale value.
<Window x:Class="LinearGauge_CustomElement.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxga="http://schemas.devexpress.com/winfx/2008/xaml/gauges"
Title="MainWindow" Height="450" Width="325">
<Grid>
<dxga:LinearGaugeControl Name="linearGaugeControl1" Width="170" >
<dxga:LinearGaugeControl.Scales>
<dxga:LinearScale >
<dxga:LinearScale.CustomElements>
<dxga:ScaleCustomElement VerticalAlignment="Top" HorizontalAlignment="Right">
<Button Name="button1" Content="Up" Width="40" Click="button1_Click" />
</dxga:ScaleCustomElement>
<dxga:ScaleCustomElement VerticalAlignment="Bottom" HorizontalAlignment="Right">
<Button Name="button2" Content="Down" Width="40" Click="button2_Click" />
</dxga:ScaleCustomElement>
</dxga:LinearScale.CustomElements>
<dxga:LinearScale.LevelBars >
<dxga:LinearScaleLevelBar x:Name="bar" Value="50" />
</dxga:LinearScale.LevelBars >
<dxga:LinearScale.Layers>
<dxga:LinearScaleLayer />
</dxga:LinearScale.Layers>
</dxga:LinearScale>
</dxga:LinearGaugeControl.Scales>
<dxga:LinearGaugeControl.Model>
<dxga:LinearCleanWhiteModel />
</dxga:LinearGaugeControl.Model>
</dxga:LinearGaugeControl>
</Grid>
</Window>
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ScaleCustomElement class.
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.