# Creating WPF Linear Gauge

One of the gauges you can create with the **RadGauge** control, is a linear gauge. It is represented by a rectangular container with a linear scale in it. Additionally, it can display various indicators that point to a certain value on the scale. This topic will walk you through the creation of a sample application that contains a linear RadGauge.

## Adding Telerik Assemblies Using NuGet

To use **RadGauge** when working with NuGet packages, install the `Telerik.Windows.Controls.DataVisualization.for.Wpf.Xaml` package. The [package name may vary](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/nuget/available-packages) slightly based on the Telerik dlls set - [Xaml or NoXaml](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/xaml-vs-noxaml)

Read more about NuGet installation in the [Installing UI for WPF from NuGet Package](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/nuget/nuget-installation) article.

> tip With the 2025 Q1 release, the Telerik UI for WPF has a new licensing mechanism. You can learn more about it [here](https://www.telerik.com/products/wpf/documentation/installation/licensing/installing-license-key).

## Adding Assembly References Manually

If you are not using NuGet packages, you can add a reference to the following assemblies:

* **Telerik.Licensing.Runtime**
* **Telerik.Windows.Controls**
* **Telerik.Windows.Controls.DataVisualization**

## Defining a Linear Gauge with a Linear Scale

The linear gauge type is represented by the **HorizontalLinearGauge** or **VerticalLinearGauge** class. You can use either of them to have vertical or horizontal orientated gauges. The linear gauge control is used for wrapping linear scales. You can place one or more **LinearScale** objects inside of it. In order to define a scale inside the **LinearGauge** control, you have to use the **LinearScale** control. The **LinearGauge** works as an **ItemsControl**, which takes **LinearScale** controls as items. This means that you can have more than one scale inside the linear gauge.

> To use the **RadGauge** control and its components in XAML you have to declare the following namespace:\
> `xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"`

**Example 1: Creating RadVerticalLinearGauge with a VerticalLinearScale**

```XAML
<telerik:RadVerticalLinearGauge Width="100" Height="200">
    <telerik:VerticalLinearScale Min="0" 
                    Max="20"
                    RelativeHeight="1"
                    RelativeY="0"
                    MiddleTickRelativeWidth="0.05\*"
                    MiddleTickRelativeHeight="0.003\*"
                    MinorTickRelativeHeight="0.003\*"
                    MajorTickRelativeHeight="0.003\*">
    </telerik:VerticalLinearScale>
</telerik:RadVerticalLinearGauge>
```

> tip To learn more about the usage of the **LinearScale** control, read the [Linear Scale](https://www.telerik.com/products/wpf/documentation/controls/radgauge/linear-scale/overview) topic.

> caption Image 1: result from example 1

![RadVerticalLinearGauge with a VerticalLinearScale](https://www.telerik.com/products/wpf/documentation/assets/0c3d3f2b74cf7e9073730398e2e0e485/radgauge_gettingstarted_lineargauge_02.png)

> The examples in this article are styled with the [Windows8](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/themes-suite/windows8) theme.

## Defining an Indicator

The **LinearScale** control allows you to display different types of indicators that point to a value on the scale. To specify an indicator use the **Indicators** property, which is of type **ItemCollection**. This means that the **Indicators** property can hold more than one indicator. Example 2 shows how you can define a LinearScale that uses a Marker indicator to mark the current value.

**Example 2: Adding Indicators**

```XAML
<telerik:RadVerticalLinearGauge Width="100" Height="200">
    <telerik:VerticalLinearScale Min="0" 
                         Max="20"
                         RelativeHeight="1"
                         RelativeY="0"
                         MiddleTickRelativeWidth="0.05\*"
                         MiddleTickRelativeHeight="0.003\*"
                         MinorTickRelativeHeight="0.003\*"
                         MajorTickRelativeHeight="0.003\*">
        <telerik:VerticalLinearScale.Indicators>
            <telerik:Marker telerik:LinearScale.RotateForVertical="True"
                            telerik:ScaleObject.RelativeWidth="0.08\*"
                            telerik:ScaleObject.RelativeHeight="0.03\*" 
                            telerik:ScaleObject.Location="OverCenter" />
        </telerik:VerticalLinearScale.Indicators>
    </telerik:VerticalLinearScale>
</telerik:RadVerticalLinearGauge>
```

> caption Image 2: result from example 2

![RadVerticalLinearGauge with Indicator](https://www.telerik.com/products/wpf/documentation/assets/b6c4953a8ee97560d1a4f3f4d065b5cb/radgauge_gettingstarted_lineargauge_03.png)

## Set Indicator's Position

To make the indicator point to a certain value on the scale, you have to use the Value property of the indicator.

**Example 3: Setting indicator's position**

```XAML
<telerik:RadVerticalLinearGauge Width="100" Height="200">
    <telerik:VerticalLinearScale Min="0" 
                         Max="20"
                         RelativeHeight="1"
                         RelativeY="0"
                         MiddleTickRelativeWidth="0.05\*"
                         MiddleTickRelativeHeight="0.003\*"
                         MinorTickRelativeHeight="0.003\*"
                         MajorTickRelativeHeight="0.003\*">
        <telerik:VerticalLinearScale.Indicators>
            <telerik:Marker Value="5"
                            telerik:LinearScale.RotateForVertical="True"
                            telerik:ScaleObject.RelativeWidth="0.08\*"
                            telerik:ScaleObject.RelativeHeight="0.03\*" 
                            telerik:ScaleObject.Location="OverCenter" />
        </telerik:VerticalLinearScale.Indicators>
    </telerik:VerticalLinearScale>
</telerik:RadVerticalLinearGauge>
```

> caption Image 3: result from example 3

![RadVerticalLinearGauge with Indicator position](https://www.telerik.com/products/wpf/documentation/assets/3bd584417826220c5098af4022586b25/radgauge_gettingstarted_lineargauge_04.png)

## Telerik UI for WPF Learning Resources

* [Telerik UI for WPF Gauge Component](https://www.telerik.com/products/wpf/gauge.aspx)
* [Getting Started with Telerik UI for WPF Components](https://www.telerik.com/products/wpf/documentation/getting-started/first-steps-nuget)
* [Telerik UI for WPF Installation](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/installation-guide)
* [Telerik UI for WPF and WinForms Integration](https://www.telerik.com/products/wpf/documentation/common-information/winforms-integration/overview)
* [Telerik UI for WPF Visual Studio Templates](https://www.telerik.com/products/wpf/documentation/installation/manual-setup-guides/visual-studio-templates)
* [Setting a Theme with Telerik UI for WPF](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-setting-a-theme-overview)
* [Telerik UI for WPF Virtual Classroom (Training Courses for Registered Users)](https://learn.telerik.com/learn/course/external/view/elearning/16/telerik-ui-for-wpf)
* [Telerik UI for WPF License Agreement](https://www.telerik.com/purchase/license-agreement/wpf-dlw-s)

## See Also

* [Ranges](https://www.telerik.com/products/wpf/documentation/controls/radgauge/features/ranges/gauge-range)
* [Indicators](https://www.telerik.com/products/wpf/documentation/controls/radgauge/features/indicators/basics)
* [Ticks](https://www.telerik.com/products/wpf/documentation/controls/radgauge/features/ticks/basics)
* [Labels](https://www.telerik.com/products/wpf/documentation/controls/radgauge/features/labels/basics)
