menu

Class SfLinearGauge - WinUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SfLinearGauge

    The linear gauge is a data visualization control that can be used to display data on a linear scale in either horizontal or vertical orientation.

    Inheritance
    System.Object
    SfLinearGauge
    Implements
    System.IDisposable
    Namespace: Syncfusion.UI.Xaml.Gauges
    Assembly: Syncfusion.Gauge.WinUI.dll
    Syntax
    public class SfLinearGauge : Control, IDisposable
    Examples

    The below examples shows, how to initialize the linear gauge.

    <gauge:SfLinearGauge IsInversed="False"
                         IsMirrored="False"
                         Orientation="Horizontal">
        <gauge:SfLinearGauge.Axis>
            <gauge:LinearAxis Minimum="0"
                              Maximum="100"
                              Interval="20"
                              CornerStyle="BothFlat"
                              UseRangeColorForAxis="True"
                              MinorTicksPerInterval="1"
                              MinorTickLength="4"
                              MajorTickLength="8">
                <gauge:LinearAxis.Ranges>
                    <gauge:LinearGaugeRange StartValue="0"
                                            EndValue="100"
                                            RangePosition="Cross"
                                            StartWidth="5"
                                            EndWidth="5">
                        <gauge:LinearGaugeRange.GradientStops>
                            <gauge:GaugeGradientStop Value="0"
                                                     Color="Green" />
                            <gauge:GaugeGradientStop Value="50"
                                                     Color="Orange" />
                            <gauge:GaugeGradientStop Value="100"
                                                     Color="Red" />
                        </gauge:LinearGaugeRange.GradientStops>
                    </gauge:LinearGaugeRange>
                </gauge:LinearAxis.Ranges>
    
                <gauge:LinearAxis.BarPointers>
                    <gauge:BarPointer Value="50"
                                      PointerSize="10"
                                      Background="Orange" 
                                      CornerStyle="BothFlat"
                                      Offset="-15" />
                </gauge:LinearAxis.BarPointers>
    
                <gauge:LinearAxis.MarkerPointers>
                    <gauge:LinearShapePointer Value="60"
                                        ShapeHeight="15"
                                        ShapeWidth="15"
                                        ShapeType="Circle"
                                        IsInteractive="True" />
    
                    <gauge:LinearContentPointer Value="20">
                        <gauge:LinearContentPointer.Content>
                            <Grid Background="BlueViolet">
                                <TextBlock Text="{Binding Value}" />
                            </Grid>
                        </gauge:LinearContentPointer.Content>
                    </gauge:LinearContentPointer>
                </gauge:LinearAxis.MarkerPointers>
            </gauge:LinearAxis>
        </gauge:SfLinearGauge.Axis>
    </gauge:SfLinearGauge>

    Constructors

    SfLinearGauge()

    Initializes a new instance of the SfLinearGauge class.

    Declaration
    public SfLinearGauge()
    Examples

    The below examples shows, how to initialize the linear gauge.

    <gauge:SfLinearGauge IsInversed="False"
                         IsMirrored="False"
                         Orientation="Horizontal">
        <gauge:SfLinearGauge.Axis>
            <gauge:LinearAxis Minimum="0"
                              Maximum="100"
                              Interval="20"
                              CornerStyle="BothFlat"
                              UseRangeColorForAxis="True"
                              MinorTicksPerInterval="1"
                              MinorTickLength="4"
                              MajorTickLength="8">
                <gauge:LinearAxis.Ranges>
                    <gauge:LinearGaugeRange StartValue="0"
                                            EndValue="100"
                                            RangePosition="Cross"
                                            StartWidth="5"
                                            EndWidth="5">
                        <gauge:LinearGaugeRange.GradientStops>
                            <gauge:GaugeGradientStop Value="0"
                                                     Color="Green" />
                            <gauge:GaugeGradientStop Value="50"
                                                     Color="Orange" />
                            <gauge:GaugeGradientStop Value="100"
                                                     Color="Red" />
                        </gauge:LinearGaugeRange.GradientStops>
                    </gauge:LinearGaugeRange>
                </gauge:LinearAxis.Ranges>
    
                <gauge:LinearAxis.BarPointers>
                    <gauge:BarPointer Value="50"
                                      PointerSize="10"
                                      Background="Orange" 
                                      CornerStyle="BothFlat"
                                      Offset="-15" />
                </gauge:LinearAxis.BarPointers>
    
                <gauge:LinearAxis.MarkerPointers>
                    <gauge:LinearShapePointer Value="60"
                                        ShapeHeight="15"
                                        ShapeWidth="15"
                                        ShapeType="Circle"
                                        IsInteractive="True" />
    
                    <gauge:LinearContentPointer Value="20">
                        <gauge:LinearContentPointer.Content>
                            <Grid Background="BlueViolet">
                                <TextBlock Text="{Binding Value}" />
                            </Grid>
                        </gauge:LinearContentPointer.Content>
                    </gauge:LinearContentPointer>
                </gauge:LinearAxis.MarkerPointers>
            </gauge:LinearAxis>
        </gauge:SfLinearGauge.Axis>
    </gauge:SfLinearGauge>

    Fields

    AxisProperty

    Identifies the Axis dependency property.

    Declaration
    public static readonly DependencyProperty AxisProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for Axis dependency property.

    IsInversedProperty

    Identifies the IsInversed dependency property.

    Declaration
    public static readonly DependencyProperty IsInversedProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for IsInversed dependency property.

    IsMirroredProperty

    Identifies the IsMirrored dependency property.

    Declaration
    public static readonly DependencyProperty IsMirroredProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for IsMirrored dependency property.

    OrientationProperty

    Identifies the Orientation dependency property.

    Declaration
    public static readonly DependencyProperty OrientationProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for Orientation dependency property.

    Properties

    Axis

    Gets or sets the linear axis to the linear gauge.

    Declaration
    public LinearAxis Axis { get; set; }
    Property Value
    Type Description
    LinearAxis

    An instance of LinearAxis.

    Examples
    <gauge:SfLinearGauge>
        <gauge:SfLinearGauge.Axis>
            <gauge:LinearAxis Minimum="-20"
                              Maximum="20"
                              CornerStyle="BothCurve">
            </gauge:LinearAxis>
        </gauge:SfLinearGauge.Axis>
    </gauge:SfLinearGauge>

    IsInversed

    Gets or sets a value indicating whether inverts the axis from right to left for a horizontal linear gauge or top to bottom for a vertical linear gauge.

    Declaration
    public bool IsInversed { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if gauge is inversed; otherwise, false.The default value is false.

    Remarks

    IsInversed decides whether the gauge will be inversed or not. If IsInversed is true, the gauge will be inversed, otherwise not inversed.

    Examples
    <gauge:SfLinearGauge IsInversed="True" />

    IsMirrored

    Gets or sets a value indicating whether to shows the gauge elements to the mirrored/opposite direction.

    Declaration
    public bool IsMirrored { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if gauge is mirrored; otherwise, false.The default value is false.

    Remarks

    IsMirrored decides whether the gauge elements will be rendered in opposite direction. If IsMirrored is true, the gauge elements will be mirrored, otherwise not mirrored.

    Examples
    <gauge:SfLinearGauge IsMirrored="True" />

    Orientation

    Gets or sets a value that indicates the dimension whether to show horizontal or vertical linear gauge.

    Declaration
    public Orientation Orientation { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.Controls.Orientation

    Orientation of linear gauge. The default is Orientation.Horizontal".

    Remarks

    Orientation decides whether the gauge will be rendered in horizontal or vertical direction.

    Examples
    <gauge:SfLinearGauge Orientation="Vertical" />

    Methods

    Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resource in SfLinearGauge.

    Declaration
    public void Dispose()

    Dispose(Boolean)

    Disposing linear gauge objects.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    Used to indicate perform dispose or not.

    OnApplyTemplate()

    Invoke to render SfLinearGauge class.

    Declaration
    protected override void OnApplyTemplate()

    OnCreateAutomationPeer()

    Declaration
    protected override AutomationPeer OnCreateAutomationPeer()
    Returns
    Type
    Microsoft.UI.Xaml.Automation.Peers.AutomationPeer

    OnPointerMoved(PointerRoutedEventArgs)

    Called when the pointer get moved.

    Declaration
    protected override void OnPointerMoved(PointerRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e

    The pointer routed event arguments.

    OnPointerPressed(PointerRoutedEventArgs)

    Called when the pointer get pressed.

    Declaration
    protected override void OnPointerPressed(PointerRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e

    The pointer routed event arguments.

    OnPointerReleased(PointerRoutedEventArgs)

    Called when the pointer get released.

    Declaration
    protected override void OnPointerReleased(PointerRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e

    The pointer routed event arguments.

    Implements

    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved