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:
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 ||Copy|
this.radGridView1.Columns["Photo"].Width = 100;
|[VB.NET] Rezise a column programatically ||Copy|
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 the
AutoSizeMode property on the desired column. Here are the available 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.SummaryRowCells - 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.