This example demonstrates how to specify the width and height of digital gauge symbols in fixed and proportional values:
- Create an instance of the SymbolLength class and specify its settings.
- Assign this instance to SymbolViewBase.Height and SymbolViewBase.Width properties.
Files to Review
Documentation
More Examples
- WPF Gauges Getting Started - Create a Digital Gauge
- WPF Gauges - Customize the Digital Gauge Control
Does this example address your development requirements/objectives?
(you will be redirected to DevExpress.com to submit your response)
Example Code
XAML<Window x:Class="Digital_Gauge.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="350" Width="525">
<Grid>
<dxga:DigitalGaugeControl Text="Hello!!!"
VerticalAlignment="Center">
<dxga:DigitalGaugeControl.Layers>
<dxga:DigitalGaugeLayer/>
</dxga:DigitalGaugeControl.Layers>
<dxga:DigitalGaugeControl.Model>
<dxga:DigitalCleanWhiteModel/>
</dxga:DigitalGaugeControl.Model>
<dxga:DigitalGaugeControl.SymbolView>
<dxga:MatrixView8x14 x:Name="matrixView"/>
</dxga:DigitalGaugeControl.SymbolView>
</dxga:DigitalGaugeControl>
<Button Name="button1" Content="Set Fixed Size" Click="button1_Click"
Height="30" Width="172" Margin="5,2,0,0" FontSize="14"
HorizontalAlignment="Left" VerticalAlignment="Top" />
<Button Name="button2" Content="Set Proportional Size" Click="button2_Click"
Height="30" Width="172" Margin="0,2,5,0" FontSize="14"
HorizontalAlignment="Right" VerticalAlignment="Top" />
</Grid>
</Window>
C#using System.Windows;
using DevExpress.Xpf.Gauges;
namespace Digital_Gauge {
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e) {
// Specify fixed values for symbol height and width.
matrixView.Width = new SymbolLength(SymbolLengthType.Fixed, 44);
matrixView.Height = new SymbolLength(SymbolLengthType.Fixed, 50);
}
private void button2_Click(object sender, RoutedEventArgs e) {
// Specify proportional values for symbol height and width.
matrixView.Width = new SymbolLength(SymbolLengthType.Proportional, 2);
matrixView.Height = new SymbolLength(SymbolLengthType.Proportional, 5);
}
}
}