Back to Devexpress

TreeListNode.ParentNode Property

windowsforms-devexpress-dot-xtratreelist-dot-nodes-dot-treelistnode-4566f5f2.md

latest5.8 KB
Original Source

TreeListNode.ParentNode Property

Gets the parent node of the current tree node.

Namespace : DevExpress.XtraTreeList.Nodes

Assembly : DevExpress.XtraTreeList.v25.2.dll

NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.TreeList

Declaration

csharp
[Browsable(false)]
public TreeListNode ParentNode { get; }
vb
<Browsable(False)>
Public ReadOnly Property ParentNode As TreeListNode

Property Value

TypeDescription
TreeListNode

A TreeListNode instance that represents the parent of the current tree node.

|

Remarks

If a tree node is at the root level, the ParentNode property returns null.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ParentNode 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.

drag-drop-grid-rows-to-treelist/CS/DragAndDropRows/Form1.cs#L82

csharp
if(destIndex > -1) {
    treeList.MoveNode(node, destNode.ParentNode, true, destIndex);
    destIndex++;

winforms-treelist-create-file-manager-drag-drop-files-folders/CS/FileList/FileListHelper.cs#L170

csharp
{
    if (e.Node.ParentNode == Tree.FocusedNode.ParentNode)
    {

winforms-treelist-implement-group-level-style-feature/CS/Q220534/Form1.cs#L29

csharp
e.Cache.FillRectangle(e.Cache.GetSolidBrush(GetColorByLevel(kvp.Key)), kvp.Value);
if (e.Node.ParentNode == null) {
    Pen linePen = e.Cache.GetPen(tree.ViewInfo.PaintAppearance.HorzLine.BackColor);

winforms-treelist-custom-check-nodes-behavior/CS/Example/TreeListCheckHelper.cs#L32

csharp
else node.CheckAll();
while(node.ParentNode != null)
{

winforms-treelist-sync-position-of-nodes-with-data-records/CS/Q351285/Form1.cs#L58

csharp
private void SaveNewRecordPosition(NodeEventArgs e) {
    var nodes = e.Node.ParentNode == null ? e.Node.TreeList.Nodes
                : e.Node.ParentNode.Nodes;

drag-drop-grid-rows-to-treelist/VB/DragAndDropRows/Form1.vb#L78

vb
If destIndex > -1 Then
    treeList.MoveNode(node, destNode.ParentNode, True, destIndex)
    destIndex += 1

winforms-treelist-implement-group-level-style-feature/VB/Q220534/Form1.vb#L28

vb
Next kvp
If e.Node.ParentNode Is Nothing Then
    Dim linePen As Pen = e.Cache.GetPen(tree.ViewInfo.PaintAppearance.HorzLine.BackColor)

winforms-treelist-custom-check-nodes-behavior/VB/Example/TreeListCheckHelper.vb#L32

vb
End If
Do While node.ParentNode IsNot Nothing
    node = node.ParentNode

winforms-treelist-create-file-manager-drag-drop-files-folders/VB/FileList/FileListHelper.vb#L142

vb
If Equals(e.Node(treeListColumn3).ToString(), "File") Then
    If e.Node.ParentNode Is Tree.FocusedNode.ParentNode Then
        e.ImageIndex = -1

winforms-treelist-sync-position-of-nodes-with-data-records/VB/Q351285/Form1.vb#L72

vb
Private Sub SaveNewRecordPosition(ByVal e As NodeEventArgs)
    Dim nodes = If(e.Node.ParentNode Is Nothing, e.Node.TreeList.Nodes, e.Node.ParentNode.Nodes)
    For i = 0 To nodes.Count - 1

See Also

TreeListNode Class

TreeListNode Members

DevExpress.XtraTreeList.Nodes Namespace