Articles in this section
Category / Section

How to change the same values in all records when the ComboBox column value is changed in WPF DataGrid?

3 mins read

In the SfDataGrid, when a column has same value in more than one row, you can update all those values in the column at once to a newly changed cell value by handling the CurrentCellValidated event. This event has two arguments, sender and CurrentCellValidatedEventArgs.

The CurrentCellValidatedEventArgs has the following properties,

  • NewValue: Gets new value from the edited cell in the DataGrid.
  • OldValue: Gets old value from the edited cell in the DataGrid.
  • Column: Gets the Grid Column of the DataGrid.
  • ErrorMessage: Gets error message to notify the error.
  • RowData: Gets the edited row data.


this.grid.CurrentCellValidated += grid_CurrentCellValidated;
private void grid_CurrentCellValidated(object sender, CurrentCellValidatedEventArgs args)
    // Get the Column Index
    int columnIndex = this.grid.SelectionController.CurrentCellManager.CurrentRowColumnIndex.ColumnIndex;
    // Get the MappingName
    var mappingName = this.grid.Columns[columnIndex].MappingName;
    if (args.Column.MappingName ==  mappingName)
        // Get the ItemSource of Grid
        var orderCollection = grid.ItemsSource as ObservableCollection<OrderInfo>;
        foreach (var record in orderCollection)
            // Check the Combobox collection only
            if (record.CustomerName == args.OldValue.ToString())
                // New value updated in that collecion if the collection have OldValue
                record.CustomerName = args.NewValue.ToString();

Here, the CurrentCellValidated event is triggered when current cell moves to another cell. When the MappingName of the Current Cell’s Column is not equal to null and MappingName is CustomerName, then all the cell values that match the old values are changed to new values by using the NewValue and OldValue properties.

The following screenshot displays the updated ComboBox column values.


In the above screenshot, the old value Thomas Hardy is repeated in more than one cell. Thus, Thomas Hardy in the CustomerName column is replaced with the selected value Ana Trujillo. The following screenshot displays the changed value.


Sample Links:






I hope you enjoyed learning about how to change the same values in all records when the ComboBox value is changed.

You can refer to our WPF DataGrid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF DataGrid example
to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment