ComponentOne Gauges for WPF and Silverlight
Gauges for WPF and Silverlight Task-Based Help / Adding Labels to the Gauge
In This Topic
    Adding Labels to the Gauge
    In This Topic

    You can add and customize the C1RadialGauge control's labeling in the Properties window, XAML, or through code. Although this topic sets the C1GaugeLabel properties of the C1RadialGauge control, the same steps can be used to customize the C1GaugeLabel of other controls.

    At Design Time

    To add labeling to the C1RadialGauge control in the Properties window at design time, complete the following steps:

    1. Click the C1RadialGauge control once to select it.
    2. Navigate to the Properties window, and click the ellipsis button next to the Decorators item. The Decorators collection editor will open.
    3. Choose C1GaugeLabel in the drop-down list in the top-left of the editor and click the Add button. A C1GaugeLabel decorator will be added to the collection and will be selected.
    4. In the right-side properties pane, set the C1GaugeLabel element's C1GaugeDecorator.Location to 1.
    5. Set the C1GaugeLabel element's C1GaugeLabel.Interval to 20.

    This will set the control's label.

    In XAML

    To add labeling to the C1RadialGauge control in XAML add the <c1:C1GaugeLabel> tag to the <c1:C1RadialGauge> tag so that it appears similar to the following:

    XAML
    Copy Code
    <c1:C1RadialGauge Height="189" Margin="42,29,188,31" Name="C1RadialGauge1" Width="189">
        <c1:C1GaugeLabel Interval="20" Location="1" />
    </c1:C1RadialGauge>
    

     

    In Code

    Right-click the window and select View Code to open the Code Editor. 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 c1gl As New C1.WPF.Gauge.C1GaugeLabel
        c1gl.Location = 1
        c1gl.Interval = 20
        Me.C1RadialGauge1.Decorators.Add(c1gl)
    End Sub
    
    Public Sub New()
    InitializeComponent()
        Dim c1gl As New C1.WPF.Gauge.C1GaugeLabel
        c1gl.Location = 1
        c1gl.Interval = 20
        Me.C1RadialGauge1.Decorators.Add(c1gl)
    End Sub
    

     

    C#
    Copy Code
    private void Window_Loaded(object sender, RoutedEventArgs e)
    {    C1.WPF.Gauge.C1GaugeLabel c1gl = new C1.WPF.Gauge.C1GaugeLabel();
        c1gl.Location = 1;
        c1gl.Interval = 20;
        this.c1RadialGauge1.Decorators.Add(c1gl);
    }
    
    public MainPage(){
    InitializeComponent();
    {    C1.WPF.Gauge.C1GaugeLabel c1gl = new C1.WPF.Gauge.C1GaugeLabel();
        c1gl.Location = 1;
        c1gl.Interval = 20;
        this.c1RadialGauge1.Decorators.Add(c1gl);
    }
    

     

    Run your project and observe:

    The C1RadialGauge control will appear with labeling: