TreeList.CellValueChanged Event
Fires immediately after a user closes a cell editor with a modified value.
Namespace: DevExpress.XtraTreeList
Assembly: DevExpress.XtraTreeList.v25.1.dll
NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.TreeList
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);
}
}
}