windowsforms-5897-controls-and-libraries-pivot-grid-data-shaping-editing-preventing-editors-from-being-activated.md
You can provide in-place editors for cells, as described in the Cell Editors Overview. In-place editors specify how cell values are represented on screen (in display mode). These editors also allow you to edit data. It’s possible to disable the data editing and use in-place editors to represent cell values in read-only mode. To disable the data editing, you can use:
the PivotGrid control’s PivotGridOptionsCustomizationEx.AllowEdit property.
a data field’s PivotGridFieldOptionsEx.AllowEdit property.
the PivotGridControl.ShowingEditor event.
The following code shows how to disable data editing for total cells. This is accomplished by handling the PivotGridControl.ShowingEditor event. When handling this event, the type of the current cell can be identified via the PivotCellEventArgsBase<TField, TData, TCustomTotal>.ColumnValueType and PivotCellEventArgsBase<TField, TData, TCustomTotal>.RowValueType parameters.
using DevExpress.XtraPivotGrid;
private void pivotGridControl1_ShowingEditor(object sender, CancelPivotCellEditEventArgs e) {
if (e.RowValueType != PivotGridValueType.Value || e.ColumnValueType != PivotGridValueType.Value)
e.Cancel = true;
}
Imports DevExpress.XtraPivotGrid
Private Sub PivotGridControl1_ShowingEditor(ByVal sender As System.Object, _
ByVal e As CancelPivotCellEditEventArgs) Handles PivotGridControl1.ShowingEditor
If e.RowValueType <> PivotGridValueType.Value OrElse e.ColumnValueType <> PivotGridValueType.Value Then
e.Cancel = True
End If
End Sub