TreeNodeCollection
Namespace: Wisej.Web
Assembly: Wisej.Framework (3.5.0.0)
Represents a collection of TreeNode objects.
- C#
- VB.NET
public class TreeNodeCollection : IList, ICollection, IEnumerable, IList<TreeNode>, ICollection<TreeNode>, IEnumerable<TreeNode>
Public Class TreeNodeCollection
Inherits IList
Implements ICollection, IEnumerable, IList(Of TreeNode), ICollection(Of TreeNode), IEnumerable(Of TreeNode)
Properties
Count
Int32: Returns the total number of TreeNode objects in the collection.
IsReadOnly
Boolean: Returns a value indicating whether the collection is read-only.
Item(index)
TreeNode: Returns or sets the TreeNode at the specified index in the collection.
Throws:
- ArgumentException The TreeNode being assigned is also a parent causing a circular reference.
- ArgumentNullException The value is null.
- ArgumentOutOfRangeException The index value is less than 0 or is greater than the number of tree nodes in the collection.
Item(key)
TreeNode: Returns the TreeNode with the specified key from the collection.
Methods
Add(text)
Adds a new tree node with the specified label text to the end of the current TreeNodeCollection.
| Parameter | Type | Description |
|---|---|---|
| text | String | The label text displayed by the TreeNode. |
Returns: TreeNode. A TreeNode that represents the tree node being added to the collection.
Add(key, text)
Creates a new TreeNode with the specified key and text, and adds it to the collection.
| Parameter | Type | Description |
|---|---|---|
| key | String | The name of the TreeNode. |
| text | String | The text to display in the TreeNode. |
Returns: TreeNode. The TreeNode that was added to the collection.
Add(key, text, imageIndex)
Creates a TreeNode with the specified key, text, and image, and adds it to the collection.
| Parameter | Type | Description |
|---|---|---|
| key | String | The name of the TreeNode. |
| text | String | The text to display in the TreeNode. |
| imageIndex | Int32 | The index of the image to display in the TreeNode. |
Returns: TreeNode. The TreeNode that was added to the collection.
Add(key, text, imageKey)
Creates a TreeNode with the specified key, text, and image, and adds it to the collection.
| Parameter | Type | Description |
|---|---|---|
| key | String | The name of the TreeNode. |
| text | String | The text to display in the TreeNode. |
| imageKey | String | The image to display in the TreeNode. |
Returns: TreeNode. The TreeNode that was added to the collection.
Add(key, text, imageIndex, selectedImageIndex)
Creates a TreeNode with the specified key, text, and images, and adds it to the collection.
| Parameter | Type | Description |
|---|---|---|
| key | String | The name of the TreeNode. |
| text | String | The text to display in the TreeNode. |
| imageIndex | Int32 | The index of the image to display in the TreeNode. |
| selectedImageIndex | Int32 | The index of the image to be displayed in the tree node when it is in a selected state. |
Returns: TreeNode. The tree node that was added to the collection.
Add(key, text, imageKey, selectedImageKey)
Creates a TreeNode with the specified key, text, and images, and adds it to the collection.
| Parameter | Type | Description |
|---|---|---|
| key | String | The name of the TreeNode. |
| text | String | The text to display in the TreeNode. |
| imageKey | String | The key of the image to display in the TreeNode. |
| selectedImageKey | String | The key of the image to display when the node is in a selected state. |
Returns: TreeNode. The TreeNode that was added to the collection.
Add(node)
Adds a previously created TreeNode to the end of the TreeNodeCollection.
| Parameter | Type | Description |
|---|---|---|
| node | TreeNode | The TreeNode to add to the collection. |
Returns: Int32. The zero-based index value of the TreeNode added to the TreeNodeCollection.
Throws:
- ArgumentNullException node is null.
- ArgumentException The node is currently assigned to another TreeView or it is a parent node causing a circular reference.
AddRange(nodes)
Adds an array of previously created TreeNode objects to the collection.
| Parameter | Type | Description |
|---|---|---|
| nodes | TreeNode[] | An array of TreeNode objects representing the tree nodes to add to the collection. |
Throws:
- ArgumentNullException nodes is null or one of the items in the collection is null.
- ArgumentException nodes is the child of another TreeView.
Clear()
Removes all tree nodes from the collection.
Clear(dispose)
Removes and disposes all tree nodes from the collection.
| Parameter | Type | Description |
|---|---|---|
| dispose | Boolean | Indicates whether to dispose the tree nodes removed from the collection. |
Contains(node)
Determines whether the specified TreeNode is a member of the collection.
| Parameter | Type | Description |
|---|---|---|
| node | TreeNode | The TreeNode to locate in the collection. |
Returns: Boolean. true if the TreeNode is a member of the collection; otherwise, false.
ContainsKey(key)
Determines whether the collection contains a TreeNode with the specified key.
| Parameter | Type | Description |
|---|---|---|
| key | String | The name of the TreeNode to search for. |
Returns: Boolean. true to indicate the collection contains a TreeNode with the specified key; otherwise, false.
CopyTo(dest, index)
Copies the entire collection into an existing array at a specified location within the array.
| Parameter | Type | Description |
|---|---|---|
| dest | Array | The destination array. |
| index | Int32 | The index in the destination array at which storing begins. |
Find(key, searchAllChildren)
Finds the TreeNode objects with specified key, optionally searching sub nodes.
| Parameter | Type | Description |
|---|---|---|
| key | String | The name of the tree node to search for. |
| searchAllChildren | Boolean | true to search child nodes of tree nodes; otherwise, false. |
Returns: TreeNode[]. An array of TreeNode objects whose Name property matches the specified key.
GetEnumerator()
Returns an enumerator that can be used to iterate through the TreeNodeCollection.
Returns: IEnumerator<TreeNode>. An IEnumerator that represents the TreeNodeCollection.
IndexOf(node)
Returns the index of the specified TreeNode in the collection.
| Parameter | Type | Description |
|---|---|---|
| node | TreeNode | The TreeNode to locate in the collection. |
Returns: Int32. The zero-based index of the item found in the tree node collection; otherwise, -1.
IndexOfKey(key)
Returns the index of the first occurrence of a TreeNode with the specified key.
| Parameter | Type | Description |
|---|---|---|
| key | String | The name of the tree node to search for. |
Returns: Int32. The zero-based index of the first occurrence of a tree node with the specified key, if found; otherwise, -1.
Insert(index, node)
Inserts an existing tree node into the tree node collection at the specified location.
| Parameter | Type | Description |
|---|---|---|
| index | Int32 | The indexed location within the collection to insert the TreeNode. |
| node | TreeNode | The TreeNode to insert into the collection. |
Throws:
- ArgumentNullException node is null.
- ArgumentException The node is currently assigned to another TreeView or it is a parent node causing a circular reference.
Insert(index, text)
Creates a TreeNode with the specified text and inserts it at the specified index.
| Parameter | Type | Description |
|---|---|---|
| index | Int32 | The location within the collection to insert the TreeNode. |
| text | String | The text to display in the TreeNode. |
Returns: TreeNode. The TreeNode that was inserted in the collection.
Insert(index, key, text)
Creates a tree node with the specified text and key, and inserts it into the collection.
| Parameter | Type | Description |
|---|---|---|
| index | Int32 | The location within the collection to insert the TreeNode. |
| key | String | The name of the TreeNode. |
| text | String | The text to display in the TreeNode. |
Returns: TreeNode. The TreeNode that was inserted in the collection.
Insert(index, key, text, imageIndex)
Creates a TreeNode with the specified key, text, and image, and inserts it into the collection at the specified index.
| Parameter | Type | Description |
|---|---|---|
| index | Int32 | The location within the collection to insert the TreeNode. |
| key | String | The name of the TreeNode. |
| text | String | The text to display in the TreeNode. |
| imageIndex | Int32 | The index of the image to display in the TreeNode. |
Returns: TreeNode. The TreeNode that was inserted in the collection.
Insert(index, key, text, imageKey)
Creates a TreeNode with the specified key, text, and image, and inserts it into the collection at the specified index.
| Parameter | Type | Description |
|---|---|---|
| index | Int32 | The location within the collection to insert the TreeNode. |
| key | String | The name of the TreeNode. |
| text | String | The text to display in the TreeNode. |
| imageKey | String | The key of the image to display in the TreeNode. |
Returns: TreeNode. The TreeNode that was inserted in the collection.
Insert(index, key, text, imageIndex, selectedImageIndex)
Creates a TreeNode with the specified key, text, and images, and inserts it into the collection at the specified index.
| Parameter | Type | Description |
|---|---|---|
| index | Int32 | The location within the collection to insert the TreeNode. |
| key | String | The name of the TreeNode. |
| text | String | The text to display in the TreeNode. |
| imageIndex | Int32 | The index of the image to display in the TreeNode. |
| selectedImageIndex | Int32 | The index of the image to display in the TreeNode when it is in a selected state. |
Returns: TreeNode. The TreeNode that was inserted in the collection.
Insert(index, key, text, imageKey, selectedImageKey)
Creates a TreeNode with the specified key, text, and images, and inserts it into the collection at the specified index.
| Parameter | Type | Description |
|---|---|---|
| index | Int32 | The location within the collection to insert the TreeNode. |
| key | String | The name of the TreeNode. |
| text | String | The text to display in the TreeNode. |
| imageKey | String | The key of the image to display in the TreeNode. |
| selectedImageKey | String | The key of the image to display in the TreeNode when it is in a selected state. |
Returns: TreeNode. The TreeNode that was inserted in the collection.
Remove(node)
Removes the specified TreeNode from the TreeNodeCollection.
| Parameter | Type | Description |
|---|---|---|
| node | TreeNode | The TreeNode to remove. |
Throws:
- ArgumentNullException node is null.
RemoveAt(index)
Removes a tree node from the tree node collection at a specified index.
| Parameter | Type | Description |
|---|---|---|
| index | Int32 | The index of the TreeNode to remove. |
RemoveByKey(key)
Removes the TreeNode with the specified key from the collection.
| Parameter | Type | Description |
|---|---|---|
| key | String | The name of the tree node to remove from the collection. |
Events
CollectionChanged
CollectionChangeEventHandler Fired when the collection changes.