# Headers

**RadVirtualGrid** has **Header** elements for both its rows and columns. A more detailed look over the visual elements of the control can be found in the [Styling and Appearance](https://www.telerik.com/products/wpf/documentation/controls/radvirtualgrid/styling-and-appearance/styling-and-appearance) topic. The API of the control provides the **HeaderValueNeeded** and **HeaderSizeNeeded** events for setting the values and size of its headers. The properties that the event arguments expose are listed below.

## HeaderValueNeeded

> important If the default **DataProvider** is used for populating the control with data, it handles the **HeaderValueNeeded** event. In order the default behavior to be altered, a [Custom Data Provider](https://www.telerik.com/products/wpf/documentation/controls/radvirtualgrid/features/custom-dataprovider) can be utilized.

* **HeaderOrientation**: Enumeration which has two values: **Horizontal** and **Vertical**. If the HeaderOrientation is Horizontal, the event is thrown for a Row Header, whereas if it is Vertical, it is thrown for a Column Header.

* **Index**: Provides information regarding the index of the Header.

* **Value**: The actual value to be applied to the Header.

## HeaderSizeNeeded

* **HeaderOrientation**: Enumeration similar to the one provided from the event arguments of the **HeaderValueNeeded** event.

* **Index**: Provides information regarding the index of the Header.

* **Size**: Sets the width or height of the header depending on the value of the **HeaderOrientation** property.

* **SizeUnit**: An enumeration that provides two values - **Pixel** and **Star**. The first one sets a precise pixel size, whereas the second one applies a relative size for the header.

**Example 1: Handling the HeaderSizeNeededEvent**

```C#
private void VirtualGrid_HeaderSizeNeeded(object sender, Telerik.Windows.Controls.VirtualGrid.HeaderSizeEventArgs e)
{
    if (e.HeaderOrientation == Telerik.Windows.Controls.VirtualGrid.VirtualGridOrientation.Horizontal)
    {
        if (e.Index % 2 == 0)
        {
            e.SizeUnit = Telerik.Windows.Controls.VirtualGrid.HeaderSizeUnit.Star;
        }
        else
        {
            e.Size = 130;
        }
    }
}
```

> caption RadVirtualGrid with custom size for the headers

![RadVirtualGrid with custom size for the headers](https://www.telerik.com/products/wpf/documentation/assets/0a887029b62b652bc1f6dfd05033893b/radvirtualgrid_features_headers01.png)

> tip To learn how to conditionally style the cells (including the header cells), you can read the [Conditional Styling](https://www.telerik.com/products/wpf/documentation/controls/radvirtualgrid/styling-and-appearance/conditional-styling).

## See Also

* [Custom Data Provider](https://www.telerik.com/products/wpf/documentation/controls/radvirtualgrid/features/custom-dataprovider)

* [Editing](https://www.telerik.com/products/wpf/documentation/controls/radvirtualgrid/features/editing)

* [Insert and Remove Data](https://www.telerik.com/products/wpf/documentation/controls/radvirtualgrid/features/insert-and-remove-data)

* [Pinned Rows and Columns](https://www.telerik.com/products/wpf/documentation/controls/radvirtualgrid/features/pinned-rows-and-columns)
