TreeNode

Wisej.Web.TreeNode

Namespace: Wisej.Web

Assembly: Wisej.Framework (2.5.0.0)

Represents a node of a TreeView.

public class TreeNode : Component, ICloneable, IHasPropertyStore

Constructors

TreeNode()

Initializes a new instance of the TreeNode class.

TreeNode(text)

Initializes a new instance of the TreeNode class with the specified label text.

NameTypeDescription

text

The label Text of the new tree node.

TreeNode(text, children)

Initializes a new instance of the TreeNode class with the specified label text and child tree nodes.

NameTypeDescription

text

The label Text of the new tree node.

children

An array of child TreeNode objects.

TreeNode(text, imageIndex, selectedImageIndex)

Initializes a new instance of the TreeNode class with the specified label text and images to display when the tree node is in a selected and unselected state.

NameTypeDescription

text

The label Text of the new tree node.

imageIndex

The index value of Image to display when the tree node is unselected.

selectedImageIndex

The index value of Image to display when the tree node is selected.

TreeNode(text, imageIndex, selectedImageIndex, children)

Initializes a new instance of the TreeNode class with the specified label text, child tree nodes, and images to display when the tree node is in a selected and unselected state.

NameTypeDescription

text

The label Text of the new tree node.

imageIndex

The index value of Image to display when the tree node is unselected.

selectedImageIndex

The index value of Image to display when the tree node is selected.

children

An array of child TreeNode objects.

Properties

AllowHtml

Boolean: Returns or sets a value indicating that the tree node can display HTML in the Text property.

BackColor

Color: Returns or sets the background color of the tree node.

CheckBox

Nullable<Boolean>: Returns or sets whether a checkbox is displayed next to the tree node.

Checked

Boolean: Returns or sets whether the tree node is in a checked state.

CheckState

CheckState: Returns or sets the checked state of the tree node.

ContextMenu

ContextMenu: Returns the shortcut menu that is associated with this tree node.

Enabled

Boolean: Returns or sets whether the tree node is in enabled.

FirstNode

TreeNode: Returns the first child tree node in the tree node collection.

ForeColor

Color: Returns or sets the foreground color of the tree node.

FullPath

String: Returns the path from the root tree node to the current tree node.

HideNodeImage

Nullable<Boolean>: Returns or sets a valid indicating whether the node image next to the tree node is hidden.

ImageIndex

Int32: Returns or sets the image list index value of the image displayed when the tree node is in the unselected state.

Throws:

ImageKey

String: Returns or sets the key for the image associated with this tree node when the node is in an unselected state.

ImageList

ImageList: Returns the ImageList that contains the images displayed in the TreeNode.

Index

Int32: Returns the position of the tree node in the tree node collection.

IsEditing

Boolean: Returns a value indicating whether the tree node is in an editable state.

IsEnabled

Boolean: Returns or sets whether the tree node is enabled.

IsExpanded

Boolean: Returns a value indicating whether the tree node is in the expanded state.

IsParent

Boolean: Returns or sets whether the tree node is a parent node and can be expanded.

Setting this property to true when the node doesn't have any children, will cause the node to expand anyway and request the child nodes from the server.

IsSelected

Boolean: Returns a value indicating whether the tree node is in the selected state.

LastNode

TreeNode: Returns the last child tree node.

LazyLoading

Boolean: Returns or sets whether child nodes are sent to the client the first time this node is expanded.

This option sends less data to the client and speeds up the creation of tree nodes with many child nodes. It can be used in conjunction with the property ShowLoader.

Level

Int32: Returns the zero-based depth of the tree node in the TreeView control.

Name

String: Returns or sets the name of the tree node.

NextNode

TreeNode: Returns the next sibling tree node.

NextVisibleNode

TreeNode: Returns the next visible tree node.

NodeFont

Font: Returns or sets the font that is used to display the text on the tree node label.

Nodes

TreeNodeCollection: Returns the collection of tree nodes assigned to the current tree node.

OpenedImageIndex

Int32: Returns or sets the index of the image that is used when the tree node is expanded.

Throws:

OpenedImageKey

String: Returns or sets the key of the image that is used when the tree node is expanded.

Parent

TreeNode: Returns the parent tree node of the current tree node.

PrevNode

TreeNode: Returns the previous sibling tree node.

PrevVisibleNode

TreeNode: Returns the previous visible tree node.

SelectedImageIndex

Int32: Returns or sets the image list index value of the image that is displayed when the tree node is in the selected state.

Throws:

SelectedImageKey

String: Returns or sets the key of the image displayed in the tree node when it is in a selected state.

ShowLoader

Boolean: Returns or sets whether the tree node shows the node-loader image when it is expanding but it doesn't have any child nodes.

StateImageIndex

Int32: Returns or sets the index of the image that is used to indicate the state of the tree node when the parent TreeView has its CheckBoxes property set to false.

Throws:

StateImageKey

String: Returns or sets the key of the image that is used to indicate the state of the tree node when the parent TreeView has its CheckBoxes property set to false.

Tag

Object: Returns or sets the object that contains data about the tree node.

Text

String: Returns or sets the text displayed in the label of the tree node.

When AllowHtml is set to true, the text can contain HTML content. If the text contains new lines (CRLF) but doesn't contain HTML elements (at least one "<") all CRLF are automatically substituted with " ".

ToolTipText

String: Returns or sets the text that appears when the mouse pointer hovers over a tree node.

TreeView

TreeView: Returns the parent TreeView.

Visible

Boolean: Returns or sets whether the tree node is visible.

Methods

BeginEdit()

Initiates the editing of the tree node label.

Throws:

Clone()

Copies the tree node and the entire subtree rooted at this tree node.

Returns: Object. The Object that represents the cloned TreeNode.

Collapse()

Collapses the tree node.

Collapse(ignoreChildren)

Collapses the tree node and optionally collapses its children.

ParameterTypeDescription

ignoreChildren

true to leave the child nodes in their current state; false to collapse the child nodes.

CollapseAll()

Collapses the tree node and all its children.

EndEdit(cancel)

Cancels the editing of the tree node label.

ParameterTypeDescription

cancel

True to discard the edited value.

EnsureVisible()

Ensures that the tree node is visible, expanding tree nodes and scrolling the tree view control as necessary.

Expand()

Expands the tree node.

ExpandAll()

Expands all the child tree nodes.

FromHandle(tree, handle)

Returns the TreeNode with the specified handle and assigned to the specified TreeView control.

ParameterTypeDescription

tree

The TreeView that contains the TreeNode.

handle

The handle of the TreeNode.

Returns: TreeNode. The TreeNode assigned to the TreeView with the specified handle.

GetNodeCount(includeSubTrees)

Returns the number of child tree nodes.

ParameterTypeDescription

includeSubTrees

true if the resulting count includes all tree nodes indirectly rooted at this tree node; otherwise, false.

Returns: Int32. The number of child tree nodes assigned to the Nodes collection.

Remove()

Removes the current tree node from the tree view control.

Toggle()

Toggles the tree node to either the expanded or collapsed state.

Update()

Updates the component on the client. Overridden to repaint the tree view in design mode.

Events

AfterCheck

TreeViewEventHandler Occurs after the tree node check box is checked.

AfterCollapse

TreeViewEventHandler Occurs after the tree node is collapsed.

AfterExpand

TreeViewEventHandler Occurs after the tree node is expanded.

AfterLabelEdit

NodeLabelEditEventHandler Occurs after the tree node label text is edited.

AfterSelect

TreeViewEventHandler Occurs after the tree node is selected.

BeforeCheck

TreeViewCancelEventHandler Occurs before the tree node check box is checked.

BeforeCollapse

TreeViewCancelEventHandler Occurs before the tree node is collapsed.

BeforeExpand

TreeViewCancelEventHandler Occurs before the tree node is expanded.

BeforeLabelEdit

NodeLabelEditEventHandler Occurs before the tree node label text is edited.

BeforeSelect

TreeViewCancelEventHandler Occurs before the tree node is selected.

ItemDrag

Deprecated: This event is deprecated. Use NodeDrag instead. ItemDragEventHandler Fired when the user begins dragging a TreeNode.

NodeDrag

TreeViewNodeDragEventHandler Fired when the user begins dragging a TreeNode.

NodeMouseClick

TreeNodeMouseClickEventHandler Fired when the user clicks a TreeNode with the mouse.

NodeMouseDoubleClick

TreeNodeMouseClickEventHandler Fired when the user double-clicks a TreeNode with the mouse.

NodeMouseHover

TreeNodeMouseHoverEventHandler Fired when the mouse hovers over a TreeNode.

NodeMouseLeave

TreeNodeMouseHoverEventHandler Fired when the mouse leaves the TreeNode.

Implements

NameDescription

All wisej components implement this interface.

Allows an object to serialize itself.

Last updated