New to Telerik UI for WPF? Start a free 30-day trial
How to Bind the Content in the Header Cell to RadGridView's DataContext
Updated on Sep 15, 2025
Environment
| Product Version | 2019.3.917 |
| Product | RadGridView for WPF |
Description
How to bind the header cells' content to properties in RadGridView's DataContext.
Solution
As the DataContext of the GridViewHeaderCell is different than the one of its parent RadGridView control, in order to bind properties of its content to such in the viewmodel, you need to use a RelativeSource binding.
XAML
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}">
<telerik:GridViewDataColumn.Header>
<TextBlock Text="{Binding DataContext.NamePropertyString, RelativeSource={RelativeSource AncestorType=telerik:RadGridView}}" />
</telerik:GridViewDataColumn.Header>
</telerik:GridViewDataColumn>