New to Telerik UI for WPF? Download free 30-day trial

RadGridView Column Header doesn't auto change width

Environment

Product Version 2019.1 220
Product RadGridView for WPF

Description

When I change RadGridView column header from a longer to a shorter string, the column header width doesn't change its size to autofit.

Solution

To make the header fit its content, reset the Width of the column when the Header changes.

public void MethodCalledWhenTheHeaderPropertyChanges() 
{ 
    var column = this.radGridView.Columns[0]; 
    column.Width = new GridViewLength(1, GridViewLengthUnitType.Pixel); 
    column.Width = new GridViewLength(1, GridViewLengthUnitType.Auto); 
} 
In this article