Back to Devexpress

GridOptions.ColumnWidthMode Property

dashboard-devexpress-dot-dashboardcommon-dot-gridoptions.md

latest4.1 KB
Original Source

GridOptions.ColumnWidthMode Property

Gets or sets the mode used to manage grid column widths.

Namespace : DevExpress.DashboardCommon

Assembly : DevExpress.Dashboard.v25.2.Core.dll

NuGet Package : DevExpress.Dashboard.Core

Declaration

csharp
[DefaultValue(GridColumnWidthMode.AutoFitToGrid)]
public GridColumnWidthMode ColumnWidthMode { get; set; }
vb
<DefaultValue(GridColumnWidthMode.AutoFitToGrid)>
Public Property ColumnWidthMode As GridColumnWidthMode

Property Value

TypeDefaultDescription
GridColumnWidthModeAutoFitToGrid

A GridColumnWidthMode enumeration value that specifies the mode used to manage grid column widths.

|

Available values:

NameDescription
Manual

The grid allows you to adjust column widths manually. You can specify the mode used to manage the width of individual columns using the GridColumnBase.WidthType property.

| | AutoFitToContents |

The grid adjusts columns automatically to the minimum width required to completely display its content. If the entire content cannot be displayed within the dashboard item, horizontal scrolling is enabled.

| | AutoFitToGrid |

The grid adjusts the width of all columns to fit their content in an optimal way. If you are changing the size of the dashboard item, the width of columns is changed proportionally.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to ColumnWidthMode
GridDashboardItem

.GridOptions .ColumnWidthMode

|

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ColumnWidthMode property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-dashboard-custom-properties/CS/WinForms-Dashboard-Custom-Properties/Modules/GridFixedColumnModule.cs#L41

csharp
GridDashboardItem gridItem = designer.Dashboard.Items[e.DashboardItemName] as GridDashboardItem;
gridItem.GridOptions.ColumnWidthMode = GridColumnWidthMode.AutoFitToContents;
foreach(GridColumnBase itemColumn in gridItem.Columns) {

winforms-dashboard-custom-properties/VB/WinForms-Dashboard-Custom-Properties/Modules/GridFixedColumnModule.vb#L41

vb
Dim gridItem As GridDashboardItem = TryCast(designer.Dashboard.Items(e.DashboardItemName), GridDashboardItem)
gridItem.GridOptions.ColumnWidthMode = GridColumnWidthMode.AutoFitToContents
For Each itemColumn As GridColumnBase In gridItem.Columns

See Also

WidthType

GridOptions Class

GridOptions Members

DevExpress.DashboardCommon Namespace