Skip to main content
All docs
V22.2

CRXPF0006 - EditValueChanging/EditValueChanged is handled in CellTemplate

Severity: Warning

The analyzer detects that you handled the BaseEdit.EditValueChanging or BaseEdit.EditValueChanged event inside a cell template (ColumnBase.CellTemplate, DataViewBase.CellTemplate, ColumnBase.CellDisplayTemplate, DataViewBase.CellDisplayTemplate, ColumnBase.CellEditTemplate, or DataViewBase.CellEditTemplate). Due to the grid’s virtualization mechanism, the GridControl raises these events when a user scrolls data.

Examples

Invalid Code

<!-- GridColumn, TreeListColumn, TableView, TreeListView, CardView -->
<!-- CellTemplate, CellDisplayTemplate, CellEditTemplate -->
<dxg:GridColumn.CellTemplate>
    <DataTemplate>
        <!-- A DevExpress.Xpf.Editors.BaseEdit descendant: -->
        <dxe:TextEdit EditValueChanging="..."/>
        <!-- OR -->
        <dxe:TextEdit EditValueChanged="..."/>
    </DataTemplate>
</dxg:GridColumn.CellTemplate>

Valid Code

<dxg:GridControl ...>
    <dxg:GridControl.View>
        <!-- A DevExpress.Xpf.Grid.DataViewBase descendant: -->
        <dxg:TableView CellValueChanging="..."/>
        <!-- OR -->
        <dxg:TableView CellValueChanged="..."/>
    </dxg:GridControl.View>
</dxg:GridControl>

How to Fix

Handle similar events for the view instead. Use the GridViewBase.CellValueChanging and GridViewBase.CellValueChanged events for TableView and CardView, and the TreeListView.CellValueChanging and TreeListView.CellValueChanged events for TreeListView.

Refer to the following help topic for more information: Events in CellTemplate.