Skip to main content
A newer version of this page is available. .

TreeList.CellValueChanged Event

Fires when a cell value is changed.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v19.1.dll

Declaration

[DXCategory("Property Changed")]
public event CellValueChangedEventHandler CellValueChanged

Event Data

The CellValueChanged event's data class is CellValueChangedEventArgs. The following properties provide information specific to this event:

Property Description
ChangedByUser Gets whether the user changed the value in the editor, or the value is changed in code.
Column Gets a column to which the cell processed by an event belongs. Inherited from CellEventArgs.
Node Gets the current Tree List node. Inherited from NodeEventArgs.
Value Gets the new value assigned to a cell.

Remarks

Users use editors to change cell values. To invoke an editor, users can click a focused cell or press the Enter, Space or F2 key. To close the editor, users can click outside the edited cell, or press the Tab or Enter key.

The CellValueChanged event fires when:

  • a user changed a value in the editor (the event fires when the editor closes)
  • a value is changed in code

    Important

    You can use the TreeListNode.SetValue method to change a cell value. The CellValueChanged event do not raise if this method method:

Example

The code below shows how to update the salesTax column when the user changes productPrice column.

treeList1.CellValueChanged += TreeList1_CellValueChanged;

private void TreeList1_CellValueChanged(object sender, DevExpress.XtraTreeList.CellValueChangedEventArgs e) {
    // If the productPrice column is changed in code,
    // the salesTax column is not updated.
    if (!e.ChangedByUser) return;
    if (e.Column.FieldName == "productPrice") {
        TreeList list = sender as TreeList;
        for (int i = 0; i < list.AllNodesCount; i++) {
            decimal price = 0.0M;
            if (decimal.TryParse(e.Value.ToString(), out price))
                list.SetRowCellValue(e.Node, "salesTax", price * 0.06M);
        }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the CellValueChanged event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also