Articles in this section
Category / Section

How to auto fit all the columns in a GridControl based on the Window size?

1 min read

GridControl provides support to automatically fit all the columns within in a view based on the Window size by using GridColumnSizer support. Also, when manually resize any column, it will automatically adjust the width of other columns to fit it within the view.

 

To achieve the above behavior, need to set the AllowAutoCalculateSize , ListenToSizeChanged and ColumnSizer properties in the Loaded event of GridControl like below.

 

C#:

private void Grid_Loaded(object sender, RoutedEventArgs e)
{
    grid.Model.Sizer.AllowAutoCalculateSize = true;
    grid.Model.Sizer.ListenToSizeChanged = true;
    grid.Model.Options.ColumnSizer = GridControlLengthUnitType.Star;
}

 

Sample Link:

WPF

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please sign in to leave a comment
Access denied
Access denied