Back to Devexpress

GridColumn.ReadOnly Property

windowsforms-devexpress-dot-xtragrid-dot-columns-dot-gridcolumn-d8c4df26.md

latest2.3 KB
Original Source

GridColumn.ReadOnly Property

Returns the OptionsColumn.ReadOnly property value.

Namespace : DevExpress.XtraGrid.Columns

Assembly : DevExpress.XtraGrid.v25.2.dll

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

Declaration

csharp
[Browsable(false)]
public bool ReadOnly { get; }
vb
<Browsable(False)>
Public ReadOnly Property [ReadOnly] As Boolean

Property Value

TypeDescription
Boolean

true if the OptionsColumn.ReadOnly option is enabled; otherwise, false.

|

Remarks

Do not rely on the ReadOnly property to determine whether users can edit cell values at runtime, since there are two more related settings: the Editable behavior option on the View level, and the OptionsColumn.AllowEdit option on the Column level.

The code sample below illustrates how to paint all read-only columns with a gray background.

csharp
using DevExpress.XtraGrid.Columns;

..

foreach (GridColumn col in gridView1.Columns)
    if (col.ReadOnly)
        col.AppearanceCell.BackColor = Color.Gray;
vb
Imports DevExpress.XtraGrid.Columns

'...
For Each col As GridColumn In gridView1.Columns
  If (col.ReadOnly) Then
    col.AppearanceCell.BackColor = Color.Gray
  End If
Next

See Also

ReadOnly

GridColumn Class

GridColumn Members

DevExpress.XtraGrid.Columns Namespace