windowsforms-devexpress-dot-xtratreelist-dot-nodes-dot-treelistnode-77488df1.md
Gets the index of the corresponding record within the associated data source.
Namespace : DevExpress.XtraTreeList.Nodes
Assembly : DevExpress.XtraTreeList.v25.2.dll
NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.TreeList
[Browsable(false)]
public int Id { get; }
<Browsable(False)>
Public ReadOnly Property Id As Integer
| Type | Description |
|---|---|
| Int32 |
An integer value representing the zero-based index of the corresponding data source record.
|
The TreeList control synchronizes its displayed data with its data source if the object it is bound to supports the IBindingList interface. This interface provides a ListChanged event which allows you to respond to data source changes. The changed data source record is identified by its index in this event. The Id property of nodes represents namely this index and thus is used to synchronize data source changes with nodes.
Nodes can be obtained by their IDs via the TreeList.FindNodeByID method call.
The following code snippets (auto-collected from DevExpress Examples) contain references to the Id property.
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.
winforms-treelist-virtual-mode/CS/ExampleMainForm.cs#L78
{
if (e.Node.Id < imageListForTree.Images.Count)
{
winforms-treelist-copy-nodes-to-another-treelist/CS/CopyNodesExample/MainForm.cs#L14
for (int i = 1; i < 5; i++) {
int parentId = treeList1.AppendNode(new object[] { $"{i}" }, -1).Id;
for (int j = 1; j < 4; j++) {
winforms-treelist-customize-cell-tooltip/CS/Form1.cs#L27
object cellInfo = new TreeListCellToolTipInfo(hit.Node, hit.Column, null);
string toolTip = string.Format("{0} (Column: {1}, Node ID: {2})", hit.Node[hit.Column], hit.Column.FieldName, hit.Node.Id);
e.Info = new DevExpress.Utils.ToolTipControlInfo(cellInfo, toolTip);
winforms-treelist-create-file-manager-drag-drop-files-folders/CS/FileList/FileListHelper.cs#L176
if (e.ImageIndex == 0)
if (e.Node.Id > Tree.FocusedNode.Id)
e.ImageIndex = 2;
winforms-treelist-virtual-mode/VB/ExampleMainForm.vb#L58
Private Sub treeList1_GetSelectImage(ByVal sender As Object, ByVal e As GetSelectImageEventArgs)
If e.Node.Id < imageListForTree.Images.Count Then
e.NodeImageIndex = e.Node.Id
winforms-treelist-copy-nodes-to-another-treelist/VB/CopyNodesExample/MainForm.vb#L15
For i = 1 To 4
Dim parentId = treeList1.AppendNode((New Object() {$"{i}"}), -1).Id
winforms-treelist-customize-cell-tooltip/VB/Form1.vb#L27
Dim cellInfo As Object = New TreeListCellToolTipInfo(hit.Node, hit.Column, Nothing)
Dim toolTip As String = String.Format("{0} (Column: {1}, Node ID: {2})", hit.Node(hit.Column), hit.Column.FieldName, hit.Node.Id)
e.Info = New DevExpress.Utils.ToolTipControlInfo(cellInfo, toolTip)
winforms-treelist-create-file-manager-drag-drop-files-folders/VB/FileList/FileListHelper.vb#L148
If e.ImageIndex = 0 Then
If e.Node.Id > Tree.FocusedNode.Id Then
e.ImageIndex = 2
See Also