# Getting Started with WinUI DataBar

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

## Assembly References

In order to add **RadDataBar** in your application, you need to add references to the following assemblies:

* `Telerik.WinUI.Controls.dll`
* `Telerik.Licensing.Runtime.dll`

## 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.

  ![WinUI RadDataBar ](https://www.telerik.com/winui/documentation/assets/5a261738a782749148fd6ba039a377ba/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.

  ![WinUI RadDataBar ](https://www.telerik.com/winui/documentation/assets/ab19b3fa343d2e656dc7698d29085b83/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.

  ![WinUI RadDataBar ](https://www.telerik.com/winui/documentation/assets/cded35a2384375c54bd880033f151b20/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 an 100 respectively.

> You can access the RadDataBar controls through an alias pointing to the Telerik.UI.Xaml.Controls.DataVisualization namespace: xmlns:dataVisualization="using:Telerik.UI.Xaml.Controls.DataVisualization"

#### **Example 1: Defining RadDataBar**

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

![WinUI RadDataBar ](https://www.telerik.com/winui/documentation/assets/3d264e839677c7520a1d041ce724b6db/raddatabar-getting-started-0.png)

## Using RadStackedDataBar

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 an 100 respectively.

#### **Example 2: Defining RadStackedDataBar**

```XAML
<dataVisualization: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 };
}
```

![WinUI RadDataBar ](https://www.telerik.com/winui/documentation/assets/a02cc2b3e9734cb2fe1822707f975011/raddatabar-getting-started-1.png)

## Using RadStacked100DataBar

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 percetange 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
<dataVisualization:RadStacked100DataBar x:Name="stackedDataBar" Height="30" Width="300" Background="#F7F9FE"/>
```

![WinUI RadDataBar ](https://www.telerik.com/winui/documentation/assets/6186d791f1401b28ba500cc807618560/raddatabar-getting-started-2.png)

## Telerik UI for WinUI Learning Resources

* [Telerik UI for WinUI DataBar Component](https://www.telerik.com/winui/databar)
* [Getting Started with Telerik UI for WinUI Components](https://www.telerik.com/winui/documentation/getting-started/first-steps-nuget)
* [Telerik UI for WinUI Installation](https://www.telerik.com/winui/documentation/installation-and-deployment/installing-which-file-do-i-need)
* [Telerik UI for WinUI Examples](https://www.telerik.com/winui/documentation/examples/demos-app)
* [Telerik UI for WinUI Accessibility](https://www.telerik.com/winui/documentation/common/accessibility)
* [Telerik UI for WinUI License Agreement](https://www.telerik.com/purchase/license-agreement/winui)

## See Also

* [Properties](https://www.telerik.com/winui/documentation/controls/raddatabar/properties-configuration)
* [Data Binding](https://www.telerik.com/winui/documentation/controls/raddatabar/databinding)
