In the previous step you created a new WPF project and added Gauges for WPF controls to the application. In this step you'll add code to your application to customize it.
Complete the following steps:
Visual Basic |
Copy Code
|
---|---|
Imports C1.WPF Imports C1.WPF.Gauge |
C# |
Copy Code
|
---|---|
using C1.WPF; using C1.WPF.Gauge; |
Visual Basic |
Copy Code
|
---|---|
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.TextChangedEventArgs) Handles TextBox1.TextChanged Me.C1LinearGauge1.Value = Me.TextBox1.Text Me.C1RadialGauge1.Value = Me.TextBox1.Text Me.C1Knob1.Value = Me.TextBox1.Text End Sub |
C# |
Copy Code
|
---|---|
private void textBox1_TextChanged(object sender, TextChangedEventArgs e) { this.c1LinearGauge1.Value = Convert.ToDouble(this.textBox1.Text); this.c1RadialGauge1.Value = Convert.ToDouble(this.textBox1.Text); this.c1Knob1.Value = Convert.ToDouble(this.textBox1.Text); } |
When a number is entered in the text box at run time, the value of the gauge controls will be set to that number.
Visual Basic |
Copy Code
|
---|---|
Private Sub C1Knob1_ValueChanged(ByVal sender As System.Object, ByVal e As C1.WPF.PropertyChangedEventArgs(Of System.Double)) Handles C1Knob1.ValueChanged Me.C1LinearGauge1.Value = Me.C1Knob1.Value Me.C1RadialGauge1.Value = Me.C1Knob1.Value Me.TextBox1.Text = Me.C1Knob1.Value.ToString End Sub |
C# |
Copy Code
|
---|---|
private void c1Knob1_ValueChanged(object sender, PropertyChangedEventArgs<double> e) { this.c1LinearGauge1.Value = this.c1Knob1.Value; this.c1RadialGauge1.Value = this.c1Knob1.Value; this.textBox1.Text = Convert.ToString(this.c1Knob1.Value); } |