TreeList.CellValueChanged Event
Fires immediately after a user closes a cell editor with a modified value.
Namespace: DevExpress.XtraTreeList
Assembly: DevExpress.XtraTreeList.v24.2.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 an 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. |
OldValue | |
Value | Gets the new value assigned to a cell. |
Remarks
Users need to activate an in-place editor in order to edit cell content. To do this, they need to click a cell or press the Enter/F2/Space key when a cell is focused. A click outside the edited cell, or the Tab/Enter key press, closes the editor. If the closed editor’s value has been modified, the CellValueChanged event occurs.
The CellValueChanged event fires when:
a user has changed the in-place editor value, and closes this editor;
a cell value was changed in code, for instance with the SetValue method (except for cases when this method is called in the event handler itself, or inside the BeginUnboundLoad/EndUnboundLoad block).
The code sample below illustrates how to update the “salesTax” column value when the “productPrice” column value changes.
treeList1.CellValueChanged += TreeList1_CellValueChanged;
private void TreeList1_CellValueChanged(object sender, DevExpress.XtraTreeList.CellValueChangedEventArgs e)
{
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);
}
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference 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.