Back to Devexpress

OptionsColumn.FixedWidth Property

windowsforms-devexpress-dot-xtragrid-dot-columns-dot-optionscolumn-fd5910e0.md

latest4.8 KB
Original Source

OptionsColumn.FixedWidth Property

Gets or sets whether this column keeps a constant width when a Grid changes its size or Best Fit operations are called. End-users are still allowed to resize this column.

Namespace : DevExpress.XtraGrid.Columns

Assembly : DevExpress.XtraGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(false)]
[XtraSerializableProperty]
public bool FixedWidth { get; set; }
vb
<DefaultValue(False)>
<XtraSerializableProperty>
Public Property FixedWidth As Boolean

Property Value

TypeDefaultDescription
Booleanfalse

true if the column keeps its width; otherwise, false.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to FixedWidth
GridColumn

.OptionsColumn .FixedWidth

|

Remarks

The code below illustrates how to lock the “Product Name” column’s width.

csharp
colProductName.OptionsColumn.FixedWidth = true;
vb
colProductName.OptionsColumn.FixedWidth = True

If there is a Band that contains only one column, and you want to lock this column’s width, enable the Band OptionsBand.FixedWidth property instead.

Users are free to resize any Grid columns at runtime, including columns with fixed widths. To lock or limit column widths at runtime, use of the following approaches:

See Columns to learn more.

The following code snippets (auto-collected from DevExpress Examples) contain references to the FixedWidth 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.

XAF-how-to-add-an-unbound-column-to-gridlisteditor-to-execute-a-custom-action-for-a-record/CS/EFCore/ButtonInListEF/ButtonInListEF.Win/Controllers/SimpleBusinessActionGridListViewController.cs#L67

csharp
buttonColumn.OptionsColumn.AllowSort = DefaultBoolean.False;
buttonColumn.OptionsColumn.FixedWidth = true;
buttonColumn.OptionsColumn.ShowInCustomizationForm = false;

winforms-grid-visualize-master-detail-data/VB/Form1.vb#L48

vb
riPictureEdit.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.Stretch
gridView1.Columns("Picture").OptionsColumn.FixedWidth = True
'Change Picture column's width

See Also

ColumnAutoWidth

Width

BestFit()

Grid Columns

OptionsColumn Class

OptionsColumn Members

DevExpress.XtraGrid.Columns Namespace