Skip to main content
Version: 4.2

TreeView

Namespace: Wisej.Web

Assembly: Wisej.Framework (4.2.0.0)

Displays a hierarchical collection of labeled items, each represented by a TreeNode.

public class TreeView : Control

Populate Nodes with root nodes and each node's child collection to build a hierarchy. SelectionMode determines whether nodes can be selected; SelectedNodes exposes the selected nodes.

ExpandAll and CollapseAll change the expansion state of the tree. BeginUpdate and EndUpdate are compatibility methods and have no effect on this control.

Constructors​

Instance member TreeView()​

Initializes a new instance of the TreeView class.

Properties​

Instance member BorderStyle​

BorderStyle: Gets or sets the border style of the tree view control. (Default: Solid)

Value: One of the BorderStyle values. The default is Solid.

Instance member ButtonAlign 4.1.7+​

Nullable<LeftRightAlignment>: Gets or sets the alignment of the plus-sign (+) and minus-sign (-) buttons. (Default: null)

Value: One of the LeftRightAlignment values, or null to use the value defined in the theme. The default is null.

Instance member CheckBoxes​

Boolean: Gets or sets whether check boxes are displayed next to the tree nodes in the tree view control. Tree nodes may override this property setting the CheckBox property. (Default: False)

Value: true if a check box is displayed next to each tree node in the tree view control; otherwise, false. The default is false.

Instance member HideNodeImages​

Boolean: Gets or sets whether all the node images are hidden. Tree nodes may override this property setting the HideNodeImage property. (Default: False)

Instance member ImageIndex​

Int32: Gets or sets the image-list index value of the default image that is displayed by the tree nodes. (Default: -1)

Value: A zero-based index that represents the position of an Image in an ImageList. The default is zero.

Throws:

Instance member ImageKey​

String: Gets or sets the key of the default image for each node in the TreeView control when it is in an unselected state. (Default: "")

Value: The key of the default image shown for each node TreeView control when the node is in an unselected state.

Instance member ImageList​

ImageList: Gets or sets the ImageList that contains the Image objects that are used by the tree nodes. (Default: null)

Value: The ImageList that contains the Image objects that are used by the tree nodes. The default value is null.

Instance member Indent​

Int32: Gets or sets the distance in pixels to indent each child tree node level. (Default: -1)

Value: The distance, in pixels, to indent each child tree node level. The default value is -1 (uses the value set in the theme.)

Throws:

Instance member ItemHeight​

Int32: Gets or sets the height of each tree node in the tree view control. When the value is -1, uses the value set in the theme. (Default: -1)

Value: The height, in pixels, of each tree node in the tree view. The default value is -1 (uses the value set in the theme.)

Throws:

Instance member LabelEdit​

Boolean: Gets or sets whether the label text of the tree nodes can be edited. (Default: False)

Value: true if the label text of the tree nodes can be edited; otherwise, false. The default is false.

Instance member Nodes​

TreeNodeCollection: Returns the collection of tree nodes that are assigned to the tree view control.

Value: A TreeNodeCollection that represents the tree nodes assigned to the tree view control.

Instance member OpenedImageIndex​

Int32: Gets or sets the image list index value of the image that is displayed when a TreeNode is expanded. (Default: -1)

Value: A zero-based index value that represents the position of an Image in an ImageList.

Throws:

Instance member OpenedImageKey​

String: Gets or sets the key of the default image shown when a TreeNode is expanded. (Default: "")

Value: The key of the default image shown when a TreeNode is in a selected state.

Instance member PathSeparator​

String: Gets or sets the delimiter string that the tree node path uses. (Default: "\")

Value: The delimiter string that the tree node FullPath property uses. The default is the backslash character ().

Instance member PrefetchItems​

Int32: Gets or sets the number of items to prefetch outside of the visible area when VirtualScroll is set to true. The default is 0 (disabled). (Default: 0)

Instance member RightClickSelection​

Boolean: Gets or sets whether the TreeNode under the pointer gets selected on a right click. (Default: False)

Value: true if a right click selects the target node; otherwise, false. The default is false.

When the right click lands outside of a selected area the selection is not changed regardless of the value of RightClickSelection.

Instance member Scrollable​

Boolean: Gets or sets whether the tree view control displays scroll bars when they are needed. (Default: True)

Value: true if the tree view control displays scroll bars when they are needed; otherwise, false. The default is true.

Instance member SelectedImageIndex​

Int32: Gets or sets the image list index value of the image that is displayed when a TreeNode is selected. (Default: -1)

Value: A zero-based index value that represents the position of an Image in an ImageList.

Throws:

Instance member SelectedImageKey​

String: Gets or sets the key of the default image shown when a TreeNode is selected. (Default: "")

Value: The key of the default image shown when a TreeNode is selected.

Instance member SelectedNode​

TreeNode: Gets or sets the tree node that is currently selected in the tree view control.

Value: The TreeNode that is currently selected in the tree view control.

Instance member SelectedNodes​

TreeNode[]: Gets or sets the tree nodes that are currently selected in the tree view control. Use this property when the SelectionMode is MultiSimple or MultiExtended.

Value: An array of TreeNode that are currently selected in the tree view control.

Instance member SelectionMode​

SelectionMode: Gets or sets the method in which items are selected in the TreeView. (Default: One)

Value: One of the SelectionMode values. The default is SelectionMode.One.

Instance member ShowNodeToolTips​

Boolean: Gets or sets a value indicating ToolTips are shown when the mouse pointer hovers over a TreeNode. (Default: False)

Value: true if ToolTips are shown when the mouse pointer hovers over a TreeNode; otherwise, false. The default is false.

Instance member ShowPlusMinus​

Boolean: Gets or sets whether plus-sign (+) and minus-sign (-) buttons are displayed next to tree nodes that contain child tree nodes. (Default: True)

Value: true if plus sign and minus sign buttons are displayed next to tree nodes that contain child tree nodes; otherwise, false. The default is true.

Instance member ShowRootLines​

Boolean: Gets or sets whether the expand/collapse icon is displayed for the root nodes (the firs level nodes). (Default: True)

Value: true to display the expand/collapse icon for the tree nodes that are at the root of the tree view; otherwise, false. The default is true.

The name of this property is kept as-is for compatibility reasons. When set to true (default) it doesn't show any line next to the root nodes or any other node. It shows or hide the expand/collapse icon next to the root nodes.

Instance member Sorted​

Boolean: Gets or sets whether the tree nodes in the tree view are sorted. (Default: False)

Value: true if the tree nodes in the tree view are sorted; otherwise, false. The default is false.

Instance member StateImageList​

ImageList: Gets or sets the image list that is used to indicate the state of the TreeView and its nodes. (Default: null)

Value: The ImageList used for indicating the state of the TreeView and its nodes.

Instance member Tools​

ComponentToolCollection: Returns the instance of ComponentToolCollection associated with this control.

Instance member TopNode​

TreeNode: Gets or sets the first fully-visible tree node in the tree view control.

Value: A TreeNode that represents the first fully-visible tree node in the tree view control.

Instance member TreeViewNodeSorter​

IComparer<TreeNode>: Gets or sets the implementation of IComparer to perform a custom sort of the TreeView nodes.

Value: The IComparer to perform the custom sort.

Instance member VirtualScroll​

Boolean: Enables or disables virtual scrolling for the TreeView. When virtual scrolling is enabled, only the visible nodes are rendered in the browser allowing the TreeView to host virtually unlimited nodes without any performance loss. (Default: False)

When VirtualScroll is set to true, all the nodes must be of the same height, limiting the more flexible HTML rendering in the nodes available when VirtualScroll is off (default).

Setting the property PrefetchItems to a value greater than 0 allows the virtual view to prefetch the specified number of items outside of the visible area to enable smoother scrolling.

Methods​

Instance member BeginUpdate()​

This method has no effect on this control.

Instance member ClearSelected()​

Unselects all nodes in the TreeView.

Instance member CollapseAll()​

Collapses all the tree nodes.

Protected member Dispose(disposing)​

Disposes the control.

ParameterTypeDescription
disposingBooleantrue when this method is called by the application rather than a finalizer.

Instance member EndUpdate()​

This method has no effect on this control.

Instance member ExpandAll()​

Expands all the tree nodes.

Instance member GetNodeCount(includeSubTrees)​

Retrieves the number of tree nodes, optionally including those in all subtrees, assigned to the tree view control.

ParameterTypeDescription
includeSubTreesBooleantrue to count the TreeNode items that the subtrees contain; otherwise, false.

Returns: Int32. The number of tree nodes, optionally including those in all subtrees, assigned to the tree view control.

Instance member GetSelected(node)​

Returns a value indicating whether the specified TreeNode is selected.

ParameterTypeDescription
nodeTreeNodeThe TreeNode to check.

Returns: Boolean. true if the specified TreeNode is currently selected in the TreeView; otherwise, false.

Throws:

Protected member OnAddReferences(items)​

Returns a collection of referenced components or collection of components.

ParameterTypeDescription
itemsIListThe items passed to the operation.

Protected member OnAfterCheck(e)​

Raises the AfterCheck event.

ParameterTypeDescription
eTreeViewEventArgsA TreeViewEventArgs that contains the event data.

Protected member OnAfterCollapse(e)​

Raises the AfterCollapse event.

ParameterTypeDescription
eTreeViewEventArgsA TreeViewEventArgs that contains the event data.

Protected member OnAfterExpand(e)​

Raises the AfterExpand event.

ParameterTypeDescription
eTreeViewEventArgsA TreeViewEventArgs that contains the event data.

Protected member OnAfterLabelEdit(e)​

Raises the AfterLabelEdit event.

ParameterTypeDescription
eNodeLabelEditEventArgsA NodeLabelEditEventArgs that contains the event data.

Protected member OnAfterSelect(e)​

Raises the AfterSelect event.

ParameterTypeDescription
eTreeViewEventArgsA TreeViewEventArgs that contains the event data.

Protected member OnBeforeCheck(e)​

Raises the BeforeCheck event.

ParameterTypeDescription
eTreeViewCancelEventArgsA TreeViewCancelEventArgs that contains the event data.

Protected member OnBeforeCollapse(e)​

Raises the BeforeCollapse event.

ParameterTypeDescription
eTreeViewCancelEventArgsA TreeViewCancelEventArgs that contains the event data.

Protected member OnBeforeExpand(e)​

Raises the BeforeExpand event.

ParameterTypeDescription
eTreeViewCancelEventArgsA TreeViewCancelEventArgs that contains the event data.

Protected member OnBeforeLabelEdit(e)​

Raises the BeforeLabelEdit event.

ParameterTypeDescription
eNodeLabelEditEventArgsA NodeLabelEditEventArgs that contains the event data.

Protected member OnBeforeSelect(e)​

Raises the BeforeSelect event.

ParameterTypeDescription
eTreeViewCancelEventArgsA TreeViewCancelEventArgs that contains the event data.

Protected member OnCreateControl()​

Creates and register this control and all its children.

Protected member OnItemDrag(e)​

Deprecated memberDeprecated: This method is deprecated. Use OnNodeDrag instead. Raises the ItemDrag event.

ParameterTypeDescription
eItemDragEventArgsAn ItemDragEventArgs that contains the event data.

Protected member OnNodeDrag(e)​

Raises the NodeDrag event.

ParameterTypeDescription
eTreeViewNodeDragEventArgsAn TreeViewNodeDragEventArgs that contains the event data.

Protected member OnNodeMouseClick(e)​

Raises the NodeMouseClick event.

ParameterTypeDescription
eTreeNodeMouseClickEventArgsA TreeNodeMouseClickEventArgs that contains the event data.

Protected member OnNodeMouseDoubleClick(e)​

Raises the NodeMouseDoubleClick event.

ParameterTypeDescription
eTreeNodeMouseClickEventArgsA TreeNodeMouseClickEventArgs that contains the event data.

Protected member OnNodeMouseHover(e)​

Raises the NodeMouseHover event.

ParameterTypeDescription
eTreeNodeMouseHoverEventArgsThe TreeNodeMouseHoverEventArgs that contains the event data.

Protected member OnNodeMouseLeave(e)​

Raises the NodeMouseLeave event.

ParameterTypeDescription
eTreeNodeMouseHoverEventArgsThe TreeNodeMouseHoverEventArgs that contains the event data.

Protected member OnToolClick(e)​

Raises the ToolClick event.

ParameterTypeDescription
eToolClickEventArgsA ToolClickEventArgs that contains the event data.

Protected member OnWebEvent(e)​

Processes the event from the client.

ParameterTypeDescription
eWisejEventArgsEvent arguments.

Protected member OnWebRender(config)​

Renders the client component.

ParameterTypeDescription
configObjectDynamic configuration object.

Protected member OnWebUpdate(state)​

Updates the client component using the state information.

ParameterTypeDescription
stateObjectDynamic state object.

Instance member SetSelected(node, selected)​

Selects or clears the selection for the specified TreeNode in a TreeView.

ParameterTypeDescription
nodeTreeNodeThe TreeNode to select.
selectedBooleanTrue to select the specified TreeNode, otherwise false to deselect it.

Throws:

Instance member Sort()​

Sorts the items in TreeView control.

Events​

Instance member AfterCheck​

TreeViewEventHandler Occurs after the tree node check box is checked.

Instance member AfterCollapse​

TreeViewEventHandler Occurs after the tree node is collapsed.

Instance member AfterExpand​

TreeViewEventHandler Occurs after the tree node is expanded.

Instance member AfterLabelEdit​

NodeLabelEditEventHandler Occurs after the tree node label text is edited.

Instance member AfterSelect​

TreeViewEventHandler Occurs after the tree node is selected.

Instance member BeforeCheck​

TreeViewCancelEventHandler Occurs before the tree node check box is checked.

Instance member BeforeCollapse​

TreeViewCancelEventHandler Occurs before the tree node is collapsed.

Instance member BeforeExpand​

TreeViewCancelEventHandler Occurs before the tree node is expanded.

Instance member BeforeLabelEdit​

NodeLabelEditEventHandler Occurs before the tree node label text is edited.

Instance member BeforeSelect​

TreeViewCancelEventHandler Occurs before the tree node is selected.

Instance member ItemDrag​

Deprecated memberDeprecated: This event is deprecated. Use NodeDrag instead. ItemDragEventHandler Occurs when the user begins dragging a node.

Instance member NodeDrag​

TreeViewNodeDragEventHandler Occurs when the user begins dragging a node.

Instance member NodeMouseClick​

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

Instance member NodeMouseDoubleClick​

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

Instance member NodeMouseHover​

TreeNodeMouseHoverEventHandler Occurs when the mouse hovers over a TreeNode.

Instance member NodeMouseLeave​

TreeNodeMouseHoverEventHandler Occurs when the mouse leaves the TreeNode.

Instance member ToolClick​

ToolClickEventHandler Occurs when a ComponentTool is clicked.

Implements​

NameDescription
IUserDataProvides access to the UserData and Tag properties associated to the component implementing this interface.
IBindableComponentBindable components implement this interface.
IDropTargetControls that support drag & drop operations implement this interface.
IWisejComponentAll wisej components implement this interface.
IWisejControlAll wisej controls derived from the Control class must implement this interface.
IWisejSerializableAllows an object to serialize itself.