The event handler receives an argument of type GetCustomNodeCellEditEventArgs containing data related to this event.
The following
GetCustomNodeCellEditEventArgs properties provide information specific to this event.
Property |
Description |
Column |
Gets a column to which the cell processed by an event belongs. |
Node |
Gets the current Tree List node. |
RepositoryItem |
Gets or sets the editor assigned to the processed cell. |
The CustomNodeCellEdit event fires for each cell within the Tree List. The event parameter's properties allow the column and node to which the current cell belongs to be identified. The cell's in-place editor is represented by the GetCustomNodeCellEditEventArgs.RepositoryItem property. Note that repository items must be added to the repository.
The editor's repository can be accessed via the Tree List's EditorContainer.RepositoryItems property.
By default, the editor assigned to a cell via the TreeListColumn.ColumnEdit property or the CustomNodeCellEdit event will be also used for editing the cell's contents. If you want to use a different editor for in-place editing, handle the CustomNodeCellEditForEditing event.
See Inplace Editors to learn more.
Special notes:
-
The CustomNodeCellEdit event fires whenever a cell is updated. For that reason, this event fires relatively frequently. Do not update Tree List visual elements or implement complex logic for the event handler as it can severely impact application performance.
-
The CustomRowCellEdit event is designed to assign ready-to-use editors to individual data cells. Do not modify properties of any existing Repository Items (including "e.RepositoryItem" objects) on this event.

Example
The following sample code handles the CustomNodeCellEdit event to assign different in-place editors (repository items) to cells. It's assumed that these editors have already been added to the Tree List's repository.
The image below shows the result.

C# |
using DevExpress.XtraTreeList;
private void treeList1_GetCustomNodeCellEdit(object sender, DevExpress.XtraTreeList.GetCustomNodeCellEditEventArgs e) {
if(e.Column.FieldName != "Category") {
object obj = e.Node.GetValue(0);
if(obj != null) {
switch(obj.ToString()) {
case "Category":
e.RepositoryItem = repositoryImageComboBox1;
break;
case "Supplier":
e.RepositoryItem = repositoryItemComboBox1;
break;
case "Unit Price":
e.RepositoryItem = repositoryItemCalcEdit1;
break;
case "Units in Stock":
e.RepositoryItem = repositoryItemSpinEdit1;
break;
case "Discontinued":
e.RepositoryItem = repositoryItemCheckEdit1;
break;
case "Last Order":
e.RepositoryItem = repositoryItemDateEdit1;
break;
case "Relevance":
e.RepositoryItem = repositoryItemProgressBar1;
break;
case "Phone":
e.RepositoryItem = repositoryItemTextEdit1;
break;
}
}
}
}
|
VB |
Imports DevExpress.XtraTreeList
Private Sub treeList1_GetCustomNodeCellEdit(ByVal sender As Object, _
ByVal e As DevExpress.XtraTreeList.GetCustomNodeCellEditEventArgs) _
Handles treeList1.CustomNodeCellEdit
If e.Column.FieldName <> "Category" Then
Dim obj As Object = e.Node.GetValue(0)
If obj IsNot Nothing Then
Select Case obj.ToString()
Case "Category"
e.RepositoryItem = repositoryImageComboBox1
Case "Supplier"
e.RepositoryItem = repositoryItemComboBox1
Case "Unit Price"
e.RepositoryItem = repositoryItemCalcEdit1
Case "Units in Stock"
e.RepositoryItem = repositoryItemSpinEdit1
Case "Discontinued"
e.RepositoryItem = repositoryItemCheckEdit1
Case "Last Order"
e.RepositoryItem = repositoryItemDateEdit1
Case "Relevance"
e.RepositoryItem = repositoryItemProgressBar1
Case "Phone"
e.RepositoryItem = repositoryItemTextEdit1
End Select
End If
End If
End Sub
|