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

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

The following example shows how to change the focused node’s state image when an in-place editor is activated and closed. To respond to activating and closing in-place editors, the TreeList.ShownEditor and TreeList.HiddenEditor events are handled. The TreeList.CellValueChanged event is handled to change the node’s select image, in order to indicate that the value of the node’s cell has been modified by an end-user.

The image below shows the result.

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;
}