wpf-devexpress-dot-xpf-dot-grid-dot-gridviewbase-fa27a1d8.md
Gets or sets a command executed when a cell value is changed.
Namespace : DevExpress.Xpf.Grid
Assembly : DevExpress.Xpf.Grid.v25.2.dll
NuGet Package : DevExpress.Wpf.Grid.Core
public ICommand<CellValueChangedArgs> CellValueChangedCommand { get; set; }
Public Property CellValueChangedCommand As ICommand(Of CellValueChangedArgs)
| Type | Description |
|---|---|
| ICommand<CellValueChangedArgs> |
A command executed when a cell value is changed.
|
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:
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];
}
<Command>
Public Sub CellValueChanged(ByVal args As CellValueChangedArgs)
If args.FieldName = "OrderType" Then (CType(args.Item, Order)).OrderPriority = priorities(CInt(args.Value))
End Sub
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