How to Highlight Header Cell when the Column is Filtered
Environment
Product Version | 2019.3.917 |
Product | RadGridView for WPF |
Description
How to style the header cells when their parent column is filtered.
Solution
To apply conditional styling of the header cells only when their parent column has a filter applied to it, you can create a style for the GridViewHeaderCell element with a DataTrigger pointing to the IsActive property of the respective column's ColumnFilterDescriptor.
<Style TargetType="telerik:GridViewHeaderCell">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Column.ColumnFilterDescriptor.(telerik:IColumnFilterDescriptor.IsActive), RelativeSource={RelativeSource Self}}" Value="True">
<Setter Property="Background" Value="Red" />
</DataTrigger>
</Style.Triggers>
</Style>