# Getting Started with WPF DataBar

This tutorial will walk you through the required steps for using **RadDataBar**.

## Adding Telerik Assemblies Using NuGet

To use **RadDataBar** 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**
* **Telerik.Windows.Data**

## Visualization Types

The RadDataBar suite contains the following controls representing the different visualizations.

* **RadDataBar**: Displays a single data bar representing a value. It is useful for comparing quantitative values of data. You can easily highlight negative values.

  ![WPF RadDataBar Normal DataBar](https://www.telerik.com/products/wpf/documentation/assets/94da1c76d0cd032a719aa6d3d734510b/raddatabar_databar.png)

* **RadStackedDataBar**: Displays a set of stacked bars where each bar represents a value. The size of each bar is calculated in accordance to the set Minimum and Maximum properties.

  ![WPF RadDataBar Stacked DataBar](https://www.telerik.com/products/wpf/documentation/assets/c24f3c16dc0442b39c9a478ddb4a0781/raddatabar_stackeddatabar.png)

* **RadStacked100DataBar**: Displays a set of stacked bars where each value represents a percentage of the value. The percent is calculated based on the bar's value and the sum of all values in the stack.

  ![WPF RadDataBar Stacked100 DataBar](https://www.telerik.com/products/wpf/documentation/assets/cb574b26966e5c34cb39b23baa7edce1/raddatabar_stacked100databar.png)

## Using RadDataBar

To display a data bar visualization, you can just add a RadDataBar control in the view and set its **Value** property. This will create a horizontal bar measured according to the Value. The value range of the bar is defined by its **Minimum** and **Maximum** properties, which default values are 0 and 100 respectively.

**Example 1: Defining RadDataBar**

```XAML
<telerik:RadDataBar Value="30" Width="300" Height="30" Background="#F7F9FE" />
```

![WPF RadDataBar Customized Appearance](https://www.telerik.com/products/wpf/documentation/assets/31b1d26508c677d4628d51fbd64f45ac/raddatabar-getting-started-0.png)

## Using RadStackedDataBar and RadStacked100DataBar

To display a stacked data bar visualization, you can add a **RadStackedDataBar** control in the view and set its **ItemsSource** property. This will create a set of stacked horizontal bars measured according to the values in the ItemsSource. The value range of the bar is defined by its **Minimum** and **Maximum** properties, which default values are 0 and 100 respectively.

**Example 2: Defining RadStackedDataBar**

```XAML
<telerik:RadStackedDataBar x:Name="stackedDataBar" Height="30" Width="300" Background="#F7F9FE"/>
```

**Example 3: Setting RadStackedDataBar ItemsSource**

```C#
public MyUserControl()
{
    InitializeComponent();
    this.stackedDataBar.ItemsSource = new List<double>() { 16, 20, 12, 32 };
}
```

![WPF RadDataBar Stacked DataBar with ItemsSource](https://www.telerik.com/products/wpf/documentation/assets/2b20d2ca39f23a31e7d7b999587732a1/raddatabar-getting-started-1.png)

The **RadStacked100DataBar** works very similar to the RadStackedDataBar, but instead of using absolute values and relying on the predefined minimum and maximum values, it displays the bars as a percentage of the whole stack. For example, the sum of the values from **Example 3** is `16 + 20 + 12 + 32 = 80` which will be the range's maximum. Then each value in the ItemsSource is turned to a value relative to the range and based on this information its bar's width is calculated. For example, 20 will be 0.25 which is 25% of the 80's range. This means that the bar for the value 20 will take 25% of the whole data bar.

To define RadStacked100DataBar, use Example 2 and 3, but replace the RadStackedDataBar with RadStacked100DataBar.

**Example 4: Defining RadStacked100DataBar**

```XAML
<telerik:RadStacked100DataBar x:Name="stackedDataBar2" Height="30" Width="300" Background="#F7F9FE"/>
```

![WPF RadDataBar Defining RadStacked100DataBar](https://www.telerik.com/products/wpf/documentation/assets/3a3d61a6c2ccd43033726edc9fee44b3/raddatabar-getting-started-2.png)

## Telerik UI for WPF Learning Resources

* [Telerik UI for WPF DataBar Component](https://www.telerik.com/products/wpf/databars.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

* [Properties](https://www.telerik.com/products/wpf/documentation/controls/raddatabar/main_properties)
* [Data Binding](https://www.telerik.com/products/wpf/documentation/controls/raddatabar/databinding)
