Disable Editing

  • 3 minutes to read

The following table summarizes properties and events you can use to disable edit operations in grid cells.

Property / Event

Applies to a Cell

Applies to a Column

Applies to a View

Affects Selection / Navigation

Allows You to Open a Cell Editor

DataViewBase.NavigationStyle

no

no

yes

yes

no

DataViewBase.AllowEditing

no

no

yes

no

no

ColumnBase.AllowEditing

no

yes

no

no

no

BaseColumn.IsEnabledBinding

yes

yes

no

no

no

ColumnBase.ReadOnly

no

yes

no

no

yes

BaseColumn.IsReadOnlyBinding

yes

yes

no

no

yes

ColumnBase.AllowFocus

no

yes

no

yes

no

ShowingEditor

yes

yes

yes

no

no

CellTemplate

no

yes

no

no

yes

CellTemplateSelector

yes

yes

no

no

yes

DataViewBase.NavigationStyle

Set the DataViewBase.NavigationStyle property to None to prevent users from focusing cells/rows.

  • Applies to a Cell: no
  • Applies to a Column: no
  • Applies to a View: yes
  • Affects Selection / Navigation: yes
  • Opens a Cell Editor: no

DataViewBase.AllowEditing

Set the DataViewBase.AllowEditing property to false to prevent end users from editing cell values within the view.

  • Applies to a Cell: no
  • Applies to a Column: no
  • Applies to a View: yes
  • Affects Selection / Navigation: no
  • Opens a Cell Editor: no

ColumnBase.AllowEditing

Set the ColumnBase.AllowEditing property to false to prevent end users from editing cell values within the column.

  • Applies to a Cell: no
  • Applies to a Column: yes
  • Applies to a View: no
  • Affects Selection / Navigation: no
  • Opens a Cell Editor: no

BaseColumn.IsEnabledBinding

Use the BaseColumn.IsEnabledBinding property to bind the enabled state of cells to a property in the data source.

  • Applies to a Cell: yes
  • Applies to a Column: yes
  • Applies to a View: no
  • Affects Selection / Navigation: no
  • Opens a Cell Editor: no

ColumnBase.ReadOnly

Set the ColumnBase.ReadOnly property to true to allow users to open the cell editor in read-only mode.

  • Applies to a Cell: no
  • Applies to a Column: yes
  • Applies to a View: no
  • Affects Selection / Navigation: no
  • Opens a Cell Editor: yes

BaseColumn.IsReadOnlyBinding

Use the BaseColumn.IsReadOnlyBinding property to bind the read-only state of cells to a property in the data source.

  • Applies to a Cell: yes
  • Applies to a Column: yes
  • Applies to a View: no
  • Affects Selection / Navigation: no
  • Opens a Cell Editor: yes

ColumnBase.AllowFocus

Set the ColumnBase.AllowFocus property to false to prevent users from focusing column cells.

  • Applies to a Cell: no
  • Applies to a Column: yes
  • Applies to a View: no
  • Affects Selection / Navigation: yes
  • Opens a Cell Editor: no

ShowingEditor

Handle the GridViewBase.ShowingEditor / TreeListView.ShowingEditor event to prevent end users from opening a corresponding cell editor.

  • Applies to a Cell: yes
  • Applies to a Column: yes
  • Applies to a View: yes
  • Affects Selection / Navigation: no
  • Opens a Cell Editor: no

CellTemplate

Use the ColumnBase.CellTemplate property to disable editing in a corresponding column. Bind the editor’s IsReadOnly property to the current row’s boolean property:

<dxg:GridColumn FieldName="Name">
    <dxg:GridColumn.CellTemplate>
        <DataTemplate>
            <dxe:TextEdit Name="PART_Editor" IsReadOnly="{Binding RowData.Row.YourBooleanProperty}" />
        </DataTemplate>
    </dxg:GridColumn.CellTemplate>
</dxg:GridColumn> 
  • Applies to a Cell: no
  • Applies to a Column: yes
  • Applies to a View: no
  • Affects Selection / Navigation: no
  • Opens a Cell Editor: yes

Note

The only supported method to set the IsReadOnly property in a ColumnBase.CellTemplate is binding. Do not use a setter to set the IsReadOnly property.

CellTemplateSelector

Use CellTemplateSelector to enable/disable editing in corresponding cells.

  • Applies to a Cell: yes
  • Applies to a Column: yes
  • Applies to a View: no
  • Affects Selection / Navigation: no
  • Opens a Cell Editor: yes