Skip to main content
All docs
V24.2

GridViewBase.CellValueChangedCommand Property

Gets or sets a command executed when a cell value is changed.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v24.2.dll

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

public ICommand<CellValueChangedArgs> CellValueChangedCommand { get; set; }

Property Value

Type Description
ICommand<CellValueChangedArgs>

A command executed when a cell value is changed.

Remarks

Bind a command to the CellValueChangedCommand property to maintain a clean MVVM pattern. The command works like a CellValueChanged event handler and allows you to process cell value changes in a View Model.

The View executes the command in the following cases:

  • A user changes a cell value and closes the in-place editor.
  • You use the GridControl.SetCellValue method to change a cell value in code.

The following code sample changes the Order Priority based on the Order Type‘s new value:

<dxg:GridControl ...>
    <dxg:GridColumn FieldName="OrderType"/>
    <dxg:GridColumn FieldName="OrderPriority"/>
    <dxg:GridControl.View>
        <dxg:TableView CellValueChangedCommand="{Binding CellValueChangedCommand}"/>
    </dxg:GridControl.View>
</dxg:GridControl>
[Command]
public void CellValueChanged(CellValueChangedArgs args) {
    if (args.FieldName == "OrderType")
        ((Order)args.Item).OrderPriority = priorities[(int)args.Value];
}

The GridControl does not call a command bound to CellValueChangedCommand when you change a cell value in a data source.

Refer to the following topic for more information: Obtain and Set Cell Values.

See Also