RadTreeNode
Represents an item in a tree view, including its display data, state, and child nodes.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class RadTreeNode : IDataItem, ICloneable, INotifyPropertyChanged
Inheritance: objectRadTreeNode
Derived Classes:
Implements:
Constructors
Creates a visible, enabled node with no text that accepts drag-and-drop operations.
public RadTreeNode()
Creates a node with the specified label, image, and initial expansion state.
Creates a node with the specified label and initial children.
public RadTreeNode(string text, RadTreeNode[] children)
The label assigned to the node's Text and Name.
childrenRadTreeNode[]The initial child nodes to add, or null for no children.
Fields
Caches this node's index in its parent collection; -1 indicates that the index must be recalculated.
protected int cachedIndex
Bit-vector key for whether the node allows drop operations.
protected const int IsAllowDropState = 64
Bit-vector key for the node's current state.
protected const int IsCurrentState = 8
Bit-vector key for the node's enabled state.
protected const int IsEnableState = 32
Bit-vector key for the node's expanded state.
protected const int IsExpandedState = 2
Bit-vector key for the node's selected state.
protected const int IsSelectedState = 4
Bit-vector key for the node's visible state.
protected const int IsVisibleState = 16
Stores node state flags addressed by the protected bit-vector keys.
protected BitVector32 state
Bit-vector key that suppresses notifications from SetBooleanProperty(string, int, bool), node updates routed through its update helper, and propagation of parent-size changes.
protected const int SuspendNotificationsState = 1
Bit-vector key that skips the initial parent-size update after an expanded-state change.
protected const int UpdateParentSizeOnExpandedChangedState = 128
Properties
Gets or sets the measured desired width for this node.
[Browsable(false)]
public Size ActualSize { get; }
Gets or sets a value indicating whether [allow drop].
[Browsable(false)]
public bool AllowDrop { get; set; }
true if [allow drop]; otherwise, false.
Gets or sets the backcolor of the tree node. Color type represents an ARGB color.
public Color BackColor { get; set; }
Gets or sets the backcolor of the tree node. This property is applicable to radial, glass, office glass, gel, and vista gradients.
public Color BackColor2 { get; set; }
Gets or sets the backcolor of the tree node. This property is applicable to radial, glass, office glass, and vista gradients.
public Color BackColor3 { get; set; }
Gets or sets the backcolor of the tree node. This property is applicable to radial, glass, office glass, and vista gradients.
public Color BackColor4 { get; set; }
Gets or sets the border color of the tree node.
public Color BorderColor { get; set; }
Gets or sets a value indicating whether this RadTreeNode is checked.
public bool Checked { get; set; }
true if checked; otherwise, false.
Gets or sets the state of the check element.
public virtual ToggleState CheckState { get; set; }
The state of the check.
Gets or sets the type of the check element.
public CheckType CheckType { get; set; }
The type of the check.
Gets or sets the measured desired width for this node.
[Browsable(false)]
public Size ChildrenSize { get; }
Gets or sets the context menu associated to the node.
public virtual RadContextMenu ContextMenu { get; set; }
Returns an instance of RadDropDownMenu that is associated with the node. The default value is null.
This property could be used to associate a custom menu and replace the treeview's default. If the context menu is invoked by right-clicking a node, the treeview's menu will not be shown and the context menu assigned to this node will be shown instead.
Gets or sets a value indicating whether this instance is current.
[Browsable(false)]
public bool Current { get; set; }
true if this instance is current; otherwise, false.
Gets the data-bound object that populated the node.
[Browsable(false)]
public object DataBoundItem { get; }
Gets or sets a value indicating whether the node can respond to user interaction.
public bool Enabled { get; set; }
The default value is true.
Gets or sets a value indicating whether this instance is expanded.
[Browsable(false)]
public bool Expanded { get; set; }
true if this instance is expanded; otherwise, false.
Gets the first node.
[Browsable(false)]
public RadTreeNode FirstNode { get; }
The first node.
Gets or sets the font of the node text.
public Font Font { get; set; }
The default value is null.
Gets or sets the foreground color of the tree node. This color is applied to the text label.
public virtual Color ForeColor { get; set; }
Gets the full path.
[Browsable(false)]
public string FullPath { get; }
The full path.
Gets or sets gradient angle for linear gradient.
public float GradientAngle { get; set; }
The default value is 90.0.
Gets or sets GradientPercentage for linear, glass, office glass, gel, vista, and radial gradients.
public float GradientPercentage { get; set; }
The default value is 0.5.
Gets or sets GradientPercentage for office glass, vista, and radial gradients.
public float GradientPercentage2 { get; set; }
The default value is 0.5.
Gets and sets the gradient style. The possible values are defined in the gradient style enumeration: solid, linear, radial, glass, office glass, gel, and vista.
public GradientStyles GradientStyle { get; set; }
The default value is GradientStyles.
Gets a value indicating whether this instance has style.
[Browsable(false)]
public bool HasStyle { get; }
true if this instance has style; otherwise, false.
Gets or sets the image of the node.
[TypeConverter(typeof(ImageTypeConverter))]
public virtual Image Image { get; set; }
Gets or sets the left image list index value of the image displayed when the tree node is not selected.
[RelatedImageList("TreeView.ImageList")]
[TypeConverter("Telerik.WinControls.UI.Design.NoneExcludedImageIndexConverter, Telerik.WinControls.UI.Design, Version=2026.3.1026.48, Culture=neutral, PublicKeyToken=5bb2a467cbec794e")]
public virtual int ImageIndex { get; set; }
Gets or sets the key for the left image associated with this tree node.
[RelatedImageList("TreeView.ImageList")]
[TypeConverter("Telerik.WinControls.UI.Design.RadImageKeyConverter, Telerik.WinControls.UI.Design, Version=2026.3.1026.48, Culture=neutral, PublicKeyToken=5bb2a467cbec794e")]
public string ImageKey { get; set; }
Gets the index.
[Browsable(false)]
public virtual int Index { get; }
The index.
Gets a value indicating whether this instance is editing.
[Browsable(false)]
public bool IsEditing { get; }
true if this instance is editing; otherwise, false.
Gets or a value indicating whether the control is in design mode.
[Browsable(false)]
public bool IsInDesignMode { get; }
Gets or sets the height of the tree node in the tree view control.
[Browsable(true)]
public int ItemHeight { get; set; }
The default value is 20.
Gets the last node.
[Browsable(false)]
public RadTreeNode LastNode { get; }
The last node.
Matches
IEnumerator<RadTreeNode>
Gets the last matches using Find method.
[Browsable(false)]
public IEnumerator<RadTreeNode> Matches { get; }
Gets the last matches using Find method.
Gets or sets the name of the RadTreeNode.
[Browsable(true)]
public string Name { get; set; }
A String that represents the name of the tree node.
The Name of a TreeNode is also the node's key, when the node is part of a RadTreeNodeCollection. If the node does not have a name, Name returns an empty string ("").
Gets the next node.
[Browsable(false)]
public RadTreeNode NextNode { get; }
The next node.
Gets the next visible node.
[Browsable(false)]
public RadTreeNode NextVisibleNode { get; }
The next visible node.
Gets the nodes.
[ListBindable(false)]
[Browsable(true)]
public RadTreeNodeCollection Nodes { get; }
The nodes.
Gets or sets the number of used colors in the gradient effect.
public int NumberOfColors { get; set; }
The default value is 4.
Gets or sets the parent.
[Browsable(false)]
public RadTreeNode Parent { get; }
The parent.
Gets the prev node.
[Browsable(false)]
public RadTreeNode PrevNode { get; }
The prev node.
Gets the prev visible node.
[Browsable(false)]
public RadTreeNode PrevVisibleNode { get; }
The prev visible node.
Gets the root parent node for this RadTreeView.
[Browsable(false)]
public RadTreeNode RootNode { get; }
The default value is null.
Gets or sets a value indicating whether this instance is selected.
[Browsable(false)]
public bool Selected { get; set; }
true if this instance is selected; otherwise, false.
Gets the style.
[Browsable(false)]
public TreeNodeStyle Style { get; }
The style.
Gets or sets the vector image of the node.
[TypeConverter(typeof(SvgImageTypeConverter))]
public virtual RadSvgImage SvgImage { get; set; }
Gets or sets the tag object that can be used to store user data, corresponding to the tree node.
[Bindable(true)]
[TypeConverter(typeof(StringConverter))]
public object Tag { get; set; }
The tag.
Gets or sets the text alignment.
public ContentAlignment TextAlignment { get; set; }
The default value is ContentAlignment.MiddleLeft.
Gets or sets the text that appears when the mouse pointer hovers over a tree node.
public string ToolTipText { get; set; }
The default value is "".
Gets the parent tree view that the tree node is assigned to.
[Browsable(false)]
public RadTreeView TreeView { get; }
Gets or sets the tree view element.
[Browsable(false)]
public RadTreeViewElement TreeViewElement { get; }
The tree view element.
Gets or sets the node value.
public virtual object Value { get; set; }
The text.
Methods
Initiates the editing of the tree node.
Stores the remaining matches from a search as a weakly held cache on this node. The cache does not keep the list alive.
protected void CacheLastFind(List<RadTreeNode> nodes)
The additional matching nodes to cache.
Cancels the edit.
Creates a new object that is a copy of the current instance.
Collapses the tree node.
public void Collapse()
Collapses the RadTreeNode and optionally collapses its children.
public void Collapse(bool ignoreChildren)
if set to true [ignore children].
Ensures that the tree node is visible, expanding tree nodes and scrolling the tree view control as necessary.
public void EnsureVisible()
Expands the tree node.
public void Expand()
Expands all the child tree nodes.
public void ExpandAll()
Finds the specified match.
public RadTreeNode Find(Predicate<RadTreeNode> match)
The match.
Returns:Finds the first node that satisfies the match function, traversing this node and its current child-node views.
public RadTreeNode Find<T>(FindAction<T> match, T arg)
The function that tests each node.
argTThe value forwarded to match for each node.
The first matching node, or null if no node matches.
When multiple nodes match, the first node weakly caches the remaining matches for access through Matches; garbage collection may remove them before they are read.
Finds the nodes.
public RadTreeNode[] FindNodes(Predicate<RadTreeNode> match)
The match.
Returns:Finds the nodes.
public RadTreeNode[] FindNodes<T>(FindAction<T> match, T arg)
The match.
argTThe argument.
Returns:Execute the action for every RadTreeNode in the branch
Appends this node's ancestor path to a buffer, separating non-root nodes with the supplied path separator.
protected virtual void GetFullPath(StringBuilder path, string pathSeparator)
The buffer to append the path to.
pathSeparatorstringThe separator placed between node labels.
Recalculates this node's check state from its immediate visible child nodes that have a check control. An attached tree view with tri-state mode disabled ignores the request.
public void InvalidateOnState()
Recalculates this node's check state, optionally visiting descendants before their parents. An attached tree view with tri-state mode disabled ignores the recalculation.
Updates the attached tree view after an expansion change, targeting one node or the whole tree.
protected virtual void NotifyExpandedChanged(RadTreeNode node)
The changed node, or null to update the entire tree view.
Raises the node's check-state property notification and reports a direct change to the tree view.
protected virtual void OnCheckStateChanged()
Raises the node's check-state property notification and reports the specified change origin to the tree view.
protected virtual void OnCheckStateChanged(CheckedMode checkedMode)
Whether the change was direct or propagated through the parent-child hierarchy.
Called when the node's data-bound object is replaced, allowing derived nodes to react to the new item.
Processes attached-tree selection and state behavior for the changed property before raising PropertyChanged. Canceled current-node or selection changes are rolled back without raising the event.
protected virtual void OnNotifyPropertyChanged(PropertyChangedEventArgs args)
The property-change details to process and publish.
Creates property-change event data for the specified name and routes it through the notification pipeline.
protected virtual void OnNotifyPropertyChanged(string name)
The changed property name.
Removes the current tree node from the tree view control.
public virtual void Remove()
Resumes property notifications after a previous SuspendPropertyNotifications() call.
public void ResumePropertyNotifications()
Changes a Boolean state bit and notifies listeners when its value changes, unless notifications are suspended.
Sets the IBindingList which holds the child nodes in Object Relational Binding mode
protected virtual void SetBoundChildNodesList(IBindingList bindingList)
Applies a check state if it differs from the current state and the tree view does not cancel the change. For a bound node, the configured checked member is updated as well.
protected virtual bool SetCheckStateCore(ToggleState value)
The check state to apply.
Returns:Suppresses notifications emitted by SetBooleanProperty(string, int, bool), returns early from the node's internal update helper, and skips parent-size propagation. Direct calls to OnNotifyPropertyChanged(string) bypass the flag and may still raise PropertyChanged or update attached-tree state.
public void SuspendPropertyNotifications()
Toggles the tree node to either the expanded or collapsed state.
public void Toggle()
Propagates this check-box state to visible, checkable descendants; when attached, the tree view must enable tri-state and automatic child checking.
protected virtual void UpdateChildrenCheckState()
Updates check state above this node: matching radio-button siblings are unchecked, and parent check boxes are recalculated in tri-state mode. An attached tree view with tri-state mode disabled does not recalculate parent check boxes.
protected virtual void UpdateParentCheckState()
Events
Occurs when the node raises a property-change notification. Notifications from state-backed properties can be suspended by SuspendPropertyNotifications().
public event PropertyChangedEventHandler PropertyChanged
Implements: