The columns inside the RadGridView are resizable by default. The user is able to easily change the column width by positioning the
mouse over the columns vertical grid line and dragging it until the desired size is achieved.
There are two ways to disable the resizing of columns in the user interface:
To restrict the resizing of all columns by the user set the AllowColumnResize property of RadGridView
[C#] Disable resizing
this.radGridView1.AllowColumnResize = false;
[VB.NET] Disable resizing
Me.RadGridView1.AllowColumnResize = False
To restrict the resizing of a particular column set the AllowResize property of the column
[C#] Disable resizing for a specified column
this.radGridView1.Columns["Photo"].AllowResize = false;
[VB.NET] Disable resizing for a specified column
Me.RadGridView1.Columns("Photo").AllowResize = False
Programatically resizing columns
The width of columns can be set individually, per column. Note that the visible width will always include some amount of data even when set
to very small amounts. To resize the columns programmatically you can use the Width property. For example:
[C#] Rezise a column programatically
this.radGridView1.Columns["Photo"].Width = 100;
[VB.NET] Rezise a column programatically
Me.RadGridView1.Columns("Photo").Width = 100
You can restrict the possible values of the Width property by setting the MinWidth and
MaxWidth properties. The MinWidth property sets a limit on how narrow the column can be
resized. The MaxWidth property determines the limit on how the column width can grow.
There are two ways to auto size the columns:
Here, columns can automatically fill the entire width of the grid. Just set the AutoSizeColumnsMode property
of the desired template to GridViewAutoSizeColumnsMode.Fill.
The column widths can be set to fit its content by using the GridViewTemplate.BestFitColumns or
GridViewDataColumn.BestFit methods. This mode distributes algorithm that attempts to fit in the header text and
column data for all visible rows.
The user can perform the best fit:
You can customize the execution of the algorithm of a concrete column by setting its AutoSizeMode property if the desired column.
There are the following options:
BestFitColumnMode.None - The column width does not automatically adjust.
BestFitColumnMode.AllCells - The column width adjusts to fit the contents all cells in the control.
BestFitColumnMode.DisplayedDataCells - The column width adjusts to fit the contents of the displayed data cells.
BestFitColumnMode.HeaderCells - The column width adjusts to fit the contents of the header cell.
BestFitColumnMode.FilterCells - The column width adjusts to fit the contents of the filter cell.
BestFitColumnMode.SymmaryRowCells - The column width adjusts to fit the contents of the summary row cell.
BestFitColumnMode.SystemCells - The column width adjusts to fit the contents of the system cells.
BestFitColumnMode.DisplayedCells - The column width adjusts to fit the contents of the displayed cells.
When the user resizes the column the ColumnWidthChanging event is fired and if it is not canceled
the ColumnWidthChanged event fires after the resize is completed.