WPF

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class TreeNode

    Show / Hide Table of Contents

    Class TreeNode

    A tree node with child nodes and default cell appearance. Each node can have multiple ChildNodes. A node can have a Data object which contents are displayed by a VirtualTreeView in multiple columns whereas each column identifies the property displayed in the cell with the MappingName.

    The GetNestedHeight() method returns the height of all nested child nodes and GetNestedRows() returns the number of visible nested nodes.

    You can check with the IsPopulated property whether child nodes have been populated. Only the visible nodes need to be populated. You can listen to the tree controls NodeExpanded event and populate child nodes on demand when this event is raised.

    Inheritance
    System.Object
    TreeNode
    Implements
    ITreeTableCounterSource
    System.ComponentModel.ISupportInitialize
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.Windows.Controls.VirtualTreeView
    Assembly: Syncfusion.GridCommon.Wpf.dll
    Syntax
    public class TreeNode : ITreeTableCounterSource, ISupportInitialize

    Constructors

    TreeNode()

    Initializes a new instance of the TreeNode class.

    Declaration
    public TreeNode()

    TreeNode(TreeNode)

    Initializes a new instance of the TreeNode class.

    Declaration
    public TreeNode(TreeNode parentNode)
    Parameters
    Type Name Description
    TreeNode parentNode

    The parent node.

    Properties

    Cells

    Gets the cell styles, one for each column.

    Declaration
    public Dictionary<int, TreeStyleInfo> Cells { get; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.Int32, TreeStyleInfo>

    The cells.

    CellStyle

    Gets or sets the default style for cells of the node.

    Declaration
    public TreeStyleInfo CellStyle { get; set; }
    Property Value
    Type Description
    TreeStyleInfo

    The cell style.

    ChildNodes

    Gets or sets the child nodes.

    Declaration
    public TreeNodes ChildNodes { get; set; }
    Property Value
    Type Description
    TreeNodes

    The child nodes.

    Data

    Gets or sets the data.

    Declaration
    public object Data { get; set; }
    Property Value
    Type Description
    System.Object

    The data.

    Depth

    Gets the depth.

    Declaration
    public int Depth { get; }
    Property Value
    Type Description
    System.Int32

    The depth.

    IsExpanded

    Gets or sets a value indicating whether this node is expanded.

    Declaration
    public bool IsExpanded { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if this node is expanded; otherwise, false.

    IsHidden

    Gets or sets a value indicating whether this node is hidden.

    Declaration
    public bool IsHidden { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if this node is hidden; otherwise, false.

    IsInitializing

    Gets a value indicating whether this instance is initializing.

    Declaration
    public bool IsInitializing { get; }
    Property Value
    Type Description
    System.Boolean

    true if this instance is initializing; otherwise, false.

    IsPopulated

    Gets a value indicating whether the child nodes are populated.

    Declaration
    public bool IsPopulated { get; }
    Property Value
    Type Description
    System.Boolean

    true if the child nodes are populated; otherwise, false.

    ItemHeight

    Gets or sets the height of the node.

    Declaration
    public double ItemHeight { get; set; }
    Property Value
    Type Description
    System.Double

    The height of the node.

    ItemRows

    Gets or sets the number of rows for this node. (don't confuse with nested rows)

    Declaration
    public int ItemRows { get; set; }
    Property Value
    Type Description
    System.Int32

    The item rows.

    Level

    Gets the level.

    Declaration
    public TreeLevel Level { get; }
    Property Value
    Type Description
    TreeLevel

    The level.

    ParentNode

    Gets the parent node.

    Declaration
    public TreeNode ParentNode { get; }
    Property Value
    Type Description
    TreeNode

    The parent node.

    ShortName

    Gets or sets the short name.

    Declaration
    public string ShortName { get; set; }
    Property Value
    Type Description
    System.String

    The short name.

    Tag

    Gets or sets the tag.

    Declaration
    public object Tag { get; set; }
    Property Value
    Type Description
    System.Object

    The tag.

    TreeModel

    Gets the tree model.

    Declaration
    public TreeModel TreeModel { get; }
    Property Value
    Type Description
    TreeModel

    The tree model.

    Methods

    AddChildNode(TreeNode)

    Adds the child node.

    Declaration
    public void AddChildNode(TreeNode treeNode)
    Parameters
    Type Name Description
    TreeNode treeNode

    The tree node.

    BeginInit()

    Signals the object that initialization is starting.

    Declaration
    public void BeginInit()

    CollapseAll()

    Collapses all child nodes.

    Declaration
    public void CollapseAll()

    CollapseAll(Boolean)

    Collapses all child nodes.

    Declaration
    public void CollapseAll(bool invalidateCounters)
    Parameters
    Type Name Description
    System.Boolean invalidateCounters

    if set to true invalidate counters top down after expanding child nodes.

    EndInit()

    Signals the object that initialization is complete.

    Declaration
    public void EndInit()

    ExpandAll()

    Expands this and all child nodes.

    Declaration
    public void ExpandAll()

    ExpandAll(Boolean)

    Expands this and all child nodes.

    Declaration
    public void ExpandAll(bool invalidateCounters)
    Parameters
    Type Name Description
    System.Boolean invalidateCounters

    if set to true invalidate counters top down after expanding child nodes.

    GetDepth()

    Gets the depth.

    Declaration
    public int GetDepth()
    Returns
    Type Description
    System.Int32

    GetItemHeight()

    Gets the height of the node (excluding nested nodes).

    Declaration
    public double GetItemHeight()
    Returns
    Type Description
    System.Double

    GetItemRows()

    Gets the number of rows for this node. (don't confuse with nested rows)

    Declaration
    public int GetItemRows()
    Returns
    Type Description
    System.Int32

    GetNestedHeight()

    Gets the total height of the nested visible nodes.

    Declaration
    public double GetNestedHeight()
    Returns
    Type Description
    System.Double

    GetNestedRows()

    Gets the number of visible nested rows.

    Declaration
    public int GetNestedRows()
    Returns
    Type Description
    System.Int32

    GetNestedTreeNodeAtHeight(Double)

    Gets the nested tree node at the specified height position relative to this node.

    Declaration
    public TreeNode GetNestedTreeNodeAtHeight(double height)
    Parameters
    Type Name Description
    System.Double height

    The height. Height 0 will return this node.

    Returns
    Type Description
    TreeNode

    GetNestedTreeNodeAtRowIndex(Int32)

    Gets the nested tree node at row index relative to this row.

    Declaration
    public TreeNode GetNestedTreeNodeAtRowIndex(int rowIndex)
    Parameters
    Type Name Description
    System.Int32 rowIndex

    Index of the row. 0 will return this node.

    Returns
    Type Description
    TreeNode

    GetNextVisibleNode()

    Gets the next visible node.

    Declaration
    public TreeNode GetNextVisibleNode()
    Returns
    Type Description
    TreeNode

    InitializeNodesMode()

    Initializes the initialize nodes mode for faster adding of nodes.

    Declaration
    public IDisposable InitializeNodesMode()
    Returns
    Type Description
    System.IDisposable

    InvalidateCounterBottomUp()

    Marks all counters dirty in this object and parent nodes.

    Declaration
    public void InvalidateCounterBottomUp()

    InvalidateCounterTopDown(Boolean)

    Marks all counters dirty in this object and child nodes.

    Declaration
    public void InvalidateCounterTopDown(bool notifyCounterSource)
    Parameters
    Type Name Description
    System.Boolean notifyCounterSource

    if set to true notify counter source.

    IsChildVisible(TreeNode)

    Determines whether the given nested node is visible.

    Declaration
    public bool IsChildVisible(TreeNode childNode)
    Parameters
    Type Name Description
    TreeNode childNode

    The node.

    Returns
    Type Description
    System.Boolean

    true if nested node is visible; otherwise, false.

    Populate()

    Populates this node.

    Declaration
    public void Populate()

    SetHidden(Boolean, Boolean)

    Sets the hidden.

    Declaration
    public void SetHidden(bool value, bool raiseChangedEvent)
    Parameters
    Type Name Description
    System.Boolean value

    if set to true [value].

    System.Boolean raiseChangedEvent

    if set to true raise VisibleNodes.ItemHiddenChanged event.

    SetIsExpanded(Boolean, Boolean)

    Sets the is expanded.

    Declaration
    public void SetIsExpanded(bool value, bool raiseEvent)
    Parameters
    Type Name Description
    System.Boolean value

    if set to true [value].

    System.Boolean raiseEvent

    if set to true [raise event].

    SetItemHeight(Double, Boolean)

    Sets the height of the node.

    Declaration
    public void SetItemHeight(double value, bool raiseChangedEvent)
    Parameters
    Type Name Description
    System.Double value

    The value.

    System.Boolean raiseChangedEvent

    if set to true raises a VisibleNodes.ItemHeightChanged event.

    Explicit Interface Implementations

    ITreeTableCounterSource.GetCounter()

    Declaration
    ITreeTableCounter ITreeTableCounterSource.GetCounter()
    Returns
    Type Description
    ITreeTableCounter

    Implements

    ITreeTableCounterSource
    System.ComponentModel.ISupportInitialize
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved