How to: Change a node's image when in-place editors are activated and closed

The example below handles the following events to change the focused node's images:

  • TreeList.ShownEditor — sets the node's state image to indicate that the node is being modified. This event fires when the editor is activated.
  • TreeList.HiddenEditor — removes the node's state image. This event fires when the editor is deactivated.
  • TreeList.CellValueChanged — sets the node's select image to indicate that the value has been modified.

cdShowingHidingEditors

using DevExpress.XtraTreeList;

private void treeList1_ShownEditor(object sender, System.EventArgs e) {
   TreeList tlist = sender as TreeList;
   tlist.FocusedNode.StateImageIndex = 0;
}

private void treeList1_HiddenEditor(object sender, System.EventArgs e) {
   TreeList tlist = sender as TreeList;
   tlist.FocusedNode.StateImageIndex = -1;
}

private void treeList1_CellValueChanged(object sender, 
DevExpress.XtraTreeList.CellValueChangedEventArgs e) {
   e.Node.SelectImageIndex = 1;
   e.Node.ImageIndex = 1;
}