Back to Devexpress

ColumnBase.ReadOnly Property

wpf-devexpress-dot-xpf-dot-grid-dot-columnbase-109fbe09.md

latest4.3 KB
Original Source

ColumnBase.ReadOnly Property

Gets or sets whether the column’s values cannot be changed by an end user. This is a dependency property.

Namespace : DevExpress.Xpf.Grid

Assembly : DevExpress.Xpf.Grid.v25.2.Core.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

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

Property Value

TypeDefaultDescription
Booleanfalse

true to prevent an end-user from changing the column’s values; otherwise, false.

|

Remarks

If the column’s ReadOnly property is set to true , its cell values cannot be modified by end users. In this instance, cell editors can be invoked, but end users can only select and copy their values. However, setting this property to true doesn’t prevent cell values to be changed in code using the GridControl.SetCellValue method.

To learn more, see Data Editing and Validation.

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

how-to-bind-wpf-grid-to-data/CS/CodeBehind/EFCore/LocalData/MainWindow.xaml#L13

xml
<dxg:GridColumn FieldName="Id" IsSmart="True"
                ReadOnly="True" />
<dxg:GridColumn FieldName="FirstName" IsSmart="True" />

wpf-data-grid-implement-crud-operations/CS/CodeBehind/EFCore/PagedAsyncSource/MainWindow.xaml#L26

xml
<dxg:GridColumn FieldName="Id" IsSmart="True"
                AllowEditing="True" ReadOnly="True" />
<dxg:GridColumn FieldName="Subject" IsSmart="True"

wpf-data-grid-edit-form-related-cells/CS/SynchronizeEditValuesInEditForm_CodeBehind/MainWindow.xaml#L13

xml
<dxg:GridControl.Columns>
    <dxg:GridColumn FieldName="Amount" ReadOnly="True"/>
    <dxg:GridColumn FieldName="Price"/>

wpf-data-grid-extend-crud-operations/CS/DetailCollectionEditing/MainWindow.xaml#L24

xml
</dxg:GridControl.View>
<dxg:GridColumn FieldName="Id" IsSmart="True" ReadOnly="True" />
<dxg:GridColumn FieldName="FirstName" IsSmart="True" />

wpf-data-grid-create-unbound-columns/CS/DXGrid_UnboundColumns_CodeBehind/Window1.xaml#L18

xml
<dxg:GridColumn FieldName="Quantity"/>
<dxg:GridColumn FieldName="Total" UnboundDataType="{x:Type sys:Decimal}" ReadOnly="True">
    <dxg:GridColumn.EditSettings>

See Also

ColumnBase Class

ColumnBase Members

DevExpress.Xpf.Grid Namespace