menu

WPF

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class TreeNodeCollection - WPF API Reference | Syncfusion

    Show / Hide Table of Contents

    Class TreeNodeCollection

    Represents a class that maintains the common functionalities of collection of TreeNode.

    Inheritance
    System.Object
    TreeNodeCollection
    Implements
    System.Collections.Generic.IList<TreeNode>
    System.Collections.Generic.ICollection<TreeNode>
    System.Collections.Generic.IEnumerable<TreeNode>
    System.Collections.IEnumerable
    System.IDisposable
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.UI.Xaml.TreeGrid
    Assembly: Syncfusion.SfGrid.WPF.dll
    Syntax
    public class TreeNodeCollection : IList<TreeNode>, ICollection<TreeNode>, IEnumerable<TreeNode>, IEnumerable, IDisposable

    Constructors

    TreeNodeCollection()

    Initializes a new instance of TreeNodeCollection class.

    Declaration
    public TreeNodeCollection()

    Fields

    isDirty

    Declaration
    protected bool isDirty
    Field Value
    Type
    System.Boolean

    Properties

    Count

    Gets the number of elements contained in the System.Collections.Generic.ICollection<T>.

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

    IsReadOnly

    Gets a value indicating whether the System.Collections.Generic.ICollection<T> is read only.

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

    true if the System.Collections.Generic.ICollection<T> is read only; otherwise false.

    Item[Int32]

    Gets or sets the element at the specified index.

    Declaration
    public TreeNode this[int index] { get; set; }
    Parameters
    Type Name Description
    System.Int32 index

    The specified index.

    Property Value
    Type Description
    TreeNode

    The element at the specified index.

    MaxLevel

    Get the maximum level of the tree.

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

    ResetCache

    Gets or sets a boolean value indicating whether to reset the cache.

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

    RootNodes

    Gets or sets the RootNodes.

    Declaration
    public TreeNodes RootNodes { get; set; }
    Property Value
    Type
    TreeNodes

    Methods

    Add(TreeNode)

    Adds an item to the System.Collections.Generic.ICollection<T>.

    Declaration
    public void Add(TreeNode item)
    Parameters
    Type Name Description
    TreeNode item

    The corresponding item.

    Clear()

    Removes all items from the System.Collections.Generic.ICollection<T>.

    Declaration
    public void Clear()

    Contains(TreeNode)

    Determines whether the System.Collections.Generic.ICollection<T> contains a specific value.

    Declaration
    public bool Contains(TreeNode item)
    Parameters
    Type Name Description
    TreeNode item

    The specified value.

    Returns
    Type Description
    System.Boolean

    true if the item is found in the System.Collections.ICollection; otherwise false.

    CopyTo(TreeNode[], Int32)

    Copies the elements of System.Collections.Generic.ICollection<T> to an System.Array starting from particular array index.

    Declaration
    public void CopyTo(TreeNode[] array, int arrayIndex)
    Parameters
    Type Name Description
    TreeNode[] array

    The Corresponding array.

    System.Int32 arrayIndex

    The corresponding array index.

    Dispose()

    Disposes all the resources used by the TreeNodeCollection class.

    Declaration
    public void Dispose()

    Dispose(Boolean)

    Disposes all the resources used by the TreeNodeCollection class.

    Declaration
    protected virtual void Dispose(bool isDisposing)
    Parameters
    Type Name Description
    System.Boolean isDisposing

    Indicates whether the call is from Dispose method or from a finalizer.

    GetCount()

    Gets the number of child nodes (+1 for the current node).

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

    The number of child nodes (+1 for the current node).

    GetEnumerator()

    Gets an enumerator that iterates thorugh the collection.

    Declaration
    public IEnumerator<TreeNode> GetEnumerator()
    Returns
    Type Description
    System.Collections.Generic.IEnumerator<TreeNode>

    An enumerator that iterates thorugh the collection.

    GetIndexFromData(Object)

    Gets the index of the specified data.

    Declaration
    public int GetIndexFromData(object data)
    Parameters
    Type Name Description
    System.Object data

    The specified data.

    Returns
    Type Description
    System.Int32

    The index

    GetMaxLevel()

    Gets the maximum level of node in the tree node collection.

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

    The maximum level of node in the tree node collection

    GetNode(Object)

    Gets the node which matches the given data.

    Declaration
    public TreeNode GetNode(object data)
    Parameters
    Type Name Description
    System.Object data

    data.

    Returns
    Type Description
    TreeNode

    TreeNode.

    IndexOf(TreeNode)

    Determines the index of a specific treenode in the System.Collections.Generic.IList<T>.

    Declaration
    public int IndexOf(TreeNode treeNode)
    Parameters
    Type Name Description
    TreeNode treeNode

    The corresponding treenode.

    Returns
    Type Description
    System.Int32

    The index of item if found in the list;otherwise, -1

    Insert(Int32, TreeNode)

    Inserts an item to System.Collections.Generic.IList<T> at the specified index.

    Declaration
    public void Insert(int index, TreeNode item)
    Parameters
    Type Name Description
    System.Int32 index

    The corresponding index.

    TreeNode item

    The specified item.

    IsNodeInView(TreeNode)

    Determines whether the TreeNode is in view or not.

    Declaration
    public bool IsNodeInView(TreeNode node)
    Parameters
    Type Name Description
    TreeNode node

    TreeNode.

    Returns
    Type Description
    System.Boolean

    true if the node is in view; otherwise , false.

    Remove(TreeNode)

    Removes the first occurence of the specified item.

    Declaration
    public bool Remove(TreeNode item)
    Parameters
    Type Name Description
    TreeNode item

    The specified item.

    Returns
    Type Description
    System.Boolean

    true if the item is succesfully removed; otherwise false.

    RemoveAt(Int32)

    Removes the item from System.Collections.Generic.IList<T> at the specified index.

    Declaration
    public void RemoveAt(int index)
    Parameters
    Type Name Description
    System.Int32 index

    The specified index.

    SetDirty()

    Sets the dirty. When this is set to true, the YAmountCache will be re-computed for the whole node.

    Declaration
    public void SetDirty()

    Explicit Interface Implementations

    IEnumerable.GetEnumerator()

    Declaration
    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type
    System.Collections.IEnumerator

    Implements

    System.Collections.Generic.IList<T>
    System.Collections.Generic.ICollection<T>
    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable
    System.IDisposable

    Extension Methods

    PivotExtension.GroupByMany<TElement>(IEnumerable<TElement>, Int32, Func<TElement, Object>[])
    PivotExtension.GroupByMany<TElement>(IEnumerable<TElement>, IEnumerable<Func<TElement, Object>>)
    FunctionalExtensions.ForEach<T>(IEnumerable, Action<T>)
    FunctionalExtensions.ForEach<T>(IEnumerable<T>, Action<T>)
    FunctionalExtensions.ToList<T>(IEnumerable)
    ChartExtensionUtils.DistinctBy<TSource, TKey>(IEnumerable<TSource>, Func<TSource, TKey>)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved