# Column Headers

This topic will guide you through the usage of the column headers, their customization as well through performing different data operations.

* [Customizing Headers](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/column-headers#customizing-the-headers)
* [Hiding the Headers](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/column-headers#hiding-the-headers)
* [Sorting](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/column-headers#sorting)
* [Filtering](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/column-headers#filtering)
* [Grouping](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/column-headers#grouping)
* [Merging the Headers](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/column-headers#merging-the-headers)
* [Text Properties](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/column-headers#text-properties)

Usually the top cell of a column is called Header. Its purpose is to set a caption for the column, which describes the data displayed in it.

> caption Displaying column headers

![Telerik UI for WPF RadGridView displaying standard column headers](https://www.telerik.com/products/wpf/documentation/assets/c438f3a8bfb7366d2515c00412336672/radgridview_columnheaders_1.png)

To set value for the header use the **Header** property of the column.

**Example 1: Setting the Header Property**

```XAML
<telerik:GridViewDataColumn DataMemberBinding="{Binding EmployeeID}"
                Header="ID" />
```

The **Header** property is of type **object** and you are not limited to just using plain text. For example, you can add a corresponding picture to be displayed as header.

**Example 2: Setting Custom Content to the Header Property**

```XAML
<telerik:GridViewDataColumn DataMemberBinding="{Binding EmployeeID}">
    <telerik:GridViewDataColumn.Header>
        <StackPanel Orientation="Horizontal">
            <Image Stretch="None"
   Source="../../Images/User.png"
   Margin="0,0,5,0" />
            <TextBlock Text="ID"
       VerticalAlignment="Center" />
        </StackPanel>
    </telerik:GridViewDataColumn.Header>
</telerik:GridViewDataColumn>
```

> caption Displaying custom content in column headers

![Telerik UI for WPF RadGridView column header with custom image and text content](https://www.telerik.com/products/wpf/documentation/assets/ab9d4d1d27ea3227ebf8cc1f30b57a4b/radgridview_columnheaders_2.png)

## Customizing the Headers

There are two elements on the headers that can be customized:

* **Header Row** - it is modified by setting an appropriate style as **HeaderRowStyle** of **RadGridView**. To learn  how to style it take a look at the [Styling the Header Row](https://www.telerik.com/products/wpf/documentation/controls/radgridview/styles-and-templates/styling-header-row) topic.
* **Header Cell** - it is styled by setting **HeaderCellStyle** for the column, which means that for each column you can have a differently styled header. To learn more about how to style the header cell take a look at the [Styling the Column Headers](https://www.telerik.com/products/wpf/documentation/controls/radgridview/styles-and-templates/styling-column-headers) topic.

## Hiding the Headers

Column headers can only be hidden by setting **ShowColumnHeaders** property of **RadGridView** to **False**.

**Example 3: Setting the ShowColumnHeaders property to False**

```XAML
<telerik:RadGridView x:Name="radGridView"
                 ShowColumnHeaders="False">
    
</telerik:RadGridView>
```

> caption Hiding the column headers

![Telerik UI for WPF RadGridView with column headers hidden](https://www.telerik.com/products/wpf/documentation/assets/74890bf6671876a166ff53d35047b0b7/radgridview_columnheaders_3.png)

## Sorting

The header of the column plays the main role when we want to sort it. It also hosts all the visual logic around this functionality. When the data is sorted by a column, its header changes its appearance and shows the sort direction via an indicator.

> caption Sorting the column

![Telerik UI for WPF RadGridView sorted column header with a sort direction indicator](https://www.telerik.com/products/wpf/documentation/assets/35c5266d79b0390b34df49d461482d4d/radgridview_columnheaders_4.png)

> tip As of Q2 2013, the user can benefit from **Column Sort Sequence Indicator**. In order to have this feature enabled you need to set ShowColumnSortIndexes property of RadGridView to True.

To learn more about the sorting functionality take a look at the [Basic Sorting](https://www.telerik.com/products/wpf/documentation/controls/radgridview/sorting/basics) topic in the Sorting chapter.

## Filtering

The header of the column hosts the built-in filtering mechanism, which allows you to filter data by the columns' values.

> caption Filtering the column

![Telerik UI for WPF RadGridView column header with the built-in filtering interface](https://www.telerik.com/products/wpf/documentation/assets/23920fffa86dcc0e4576bc2daec3317e/radgridview_columnheaders_5.png)

To learn more about the filtering functionality take a look at the [Basic Filtering](https://www.telerik.com/products/wpf/documentation/controls/radgridview/filtering/basic) topic in the Filtering chapter.

## Grouping

The header is also used for grouping data. It has to be dragged into the group panel at the top of the control in order to get the data grouped by that column.

> caption Grouping the column

![Telerik UI for WPF RadGridView column header dragged to the group panel for grouping](https://www.telerik.com/products/wpf/documentation/assets/8fda131014d60d36d0014ab8e6fa6942/radgridview_columnheaders_6.png)

To learn more about the grouping functionality take a look at the [Basic Grouping](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/basics) topic in the Grouping chapter.

## Merging the Headers

Columns in RadGridView can be grouped in **column groups**(added with **Q3 2011**). [Read more](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/column-groups).

## Text Properties

As of **Q2 2016**, **GridViewHeaderCell** exposes **TextWrapping**, **TextAlignment**, **TextTrimming** and **TextDecorations** properties. These customizations can be also applied on column level through the **HeaderTextWrapping**, **HeaderTextAlignment**, **HeaderTextTrimming** and **HeaderTextDecorations** properties. If the same property is set to **both elements**, the value of the one corresponding to **GridViewColumn** will be respected.

**Example 5: Setting the Text Properties of GridViewHeaderCell and GridViewColumn**

```XAML
<Window.Resources>
    <Style TargetType="telerik:GridViewHeaderCell"
           		x:Key="HeaderCellStyle">
        <Setter Property="TextAlignment" 
                Value="Left"/>
    </Style>
</Window.Resources>


<telerik:RadGridView Name="clubsGrid" 
                    ItemsSource="{Binding Clubs}"
                    AutoGenerateColumns="False"
                    GroupRenderMode="Flat">
        <telerik:RadGridView.Columns>
           <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"
                                       HeaderCellStyle="{StaticResource HeaderCellStyle}"
                                       HeaderTextAlignment="Right"/>
               
           <telerik:GridViewDataColumn DataMemberBinding="{Binding Established}"
                                       Header="Est." 
                                       DataFormatString="{}{0:yyyy}"
                                       HeaderTextAlignment="Right"/>
              
           <telerik:GridViewDataColumn DataMemberBinding="{Binding StadiumCapacity}" 
                                       Header="Stadium" 
                                       DataFormatString="{}{0:N0}"
                                       HeaderTextTrimming="WordEllipsis"/>

           <telerik:GridViewDataColumn DataMemberBinding="{Binding FanClubCount}"
                                       HeaderTextDecorations="Underline"/>
   	</telerik:RadGridView.Columns>
</telerik:RadGridView>
```

> caption Setting the text properties of GridViewHeaderCell and GridViewColumn

![Telerik UI for WPF RadGridView column headers using custom text alignment, trimming, and decorations](https://www.telerik.com/products/wpf/documentation/assets/4581cda037a937a4e6f31a34b28d19d3/gridview-header-textproperties.png)

Note, that the first column has a **HeaderCellStyle** defined, which aligns the content of the **HeaderCell** to the left, but the **Style** is not applied, as the **HeaderTextAlignment** of **GridViewColumn** is also being set.

## See Also

* [Column Footers](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/column-footers)
* [Column Groups](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/column-groups)
* [Aggregate Functions](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/aggregate-functions)
* [Resizing Columns](https://www.telerik.com/products/wpf/documentation/controls/radgridview/columns/resizing-columns)
