You can add tick marks to the C1LinearGauge control through the Properties window, XAML, or through code. Although this topic sets the C1GaugeMark properties of the C1LinearGauge control, the same steps can be used to customize the C1GaugeMark of other controls.
At Design Time
To add tick marks to the C1LinearGauge control in the Properties window at design time, complete the following steps:
In XAML
To add labeling to the C1LinearGauge control in XAML add three <c1:C1GaugeMark> tags to the <c1:C1LinearGauge> tag so that it appears similar to the following:
XAML |
Copy Code
|
---|---|
<c1:C1LinearGauge Height="89" Margin="90,72,41,88" Name="C1LinearGauge1" Width="287"> <c1:C1GaugeMark Interval="20" Location="1.1" /> <c1:C1GaugeMark Interval="10" Location="1.1" /> <c1:C1GaugeMark Interval="5" Location="1.1" /> </c1:C1LinearGauge> |
In Code
Right-click the window and click View Code to switch to the Code Editor. And add code to the Window1_Loaded event handler or main class, so it appears similar to the following:
Visual Basic |
Copy Code
|
---|---|
Window1_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded Dim c1gm1 As New C1.WPF.Gauge.C1GaugeMark c1gm1.Location = 1.1 c1gm1.Interval = 20 Me.C1LinearGauge1.Decorators.Add(c1gm1) Dim c1gm2 As New C1.WPF.Gauge.C1GaugeMark c1gm2.Location = 1.1 c1gm2.Interval = 10 Me.C1LinearGauge1.Decorators.Add(c1gm2) Dim c1gm3 As New C1.WPF.Gauge.C1GaugeMark c1gm3.Location = 1.1 c1gm3.Interval = 5 Me.C1LinearGauge1.Decorators.Add(c1gm3) End Sub Public Sub New() InitializeComponent() Dim c1gm1 As New C1.WPF.Gauge.C1GaugeMark c1gm1.Location = 1.1 c1gm1.Interval = 20 Me.C1LinearGauge1.Decorators.Add(c1gm1) Dim c1gm2 As New C1.WPF.Gauge.C1GaugeMark c1gm2.Location = 1.1 c1gm2.Interval = 10 Me.C1LinearGauge1.Decorators.Add(c1gm2) Dim c1gm3 As New C1.WPF.Gauge.C1GaugeMark c1gm3.Location = 1.1 c1gm3.Interval = 5 Me.C1LinearGauge1.Decorators.Add(c1gm3) End Sub |
C# |
Copy Code
|
---|---|
private void Window_Loaded(object sender, RoutedEventArgs e) { C1.WPF.Gauge.C1GaugeLabel c1gm1 = new C1.WPF.Gauge.C1GaugeMark(); c1gm1.Location = 1.1; c1gm1.Interval = 20; this.c1LinearGauge1.Decorators.Add(c1gm1); C1.WPF.Gauge.C1GaugeLabel c1gm2 = new C1.WPF.Gauge.C1GaugeMark(); c1gm2.Location = 1.1; c1gm2.Interval = 10; this.c1LinearGauge1.Decorators.Add(c1gm2); C1.WPF.Gauge.C1GaugeLabel c1gm3 = new C1.WPF.Gauge.C1GaugeMark(); c1gm3.Location = 1.1; c1gm3.Interval = 5; this.c1LinearGauge1.Decorators.Add(c1gm3); } public MainPage(){ InitializeComponent(); { C1.WPF.Gauge.C1GaugeLabel c1gm1 = new C1. C1.WPF.Gauge.C1GaugeMark(); c1gm1.Location = 1.1; c1gm1.Interval = 20; this.c1LinearGauge1.Decorators.Add(c1gm1); C1.WPF.Gauge.C1GaugeLabel c1gm2 = new C1.WPF.Gauge.C1GaugeMark(); c1gm2.Location = 1.1; c1gm2.Interval = 10; this.c1LinearGauge1.Decorators.Add(c1gm2); C1.WPF.Gauge.C1GaugeLabel c1gm3 = new C1.WPF.Gauge.C1GaugeMark(); c1gm3.Location = 1.1; c1gm3.Interval = 5; this.c1LinearGauge1.Decorators.Add(c1gm3); } |
Run your project and observe:
The C1LinearGauge control will appear with tick marks of three sizes: