New to Telerik UI for WinFormsStart a free 30-day trial

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

C#
public class RadTreeNode : IDataItem, ICloneable, INotifyPropertyChanged

Inheritance: objectRadTreeNode

Derived Classes: FileBrowserTreeNodeDataFilterAddNodeDataFilterCriteriaNodeDataFilterGroupNodeFieldTreeNode

Implements: ICloneableIDataItemINotifyPropertyChanged

Constructors

C#
public RadTreeNode()

Initializes new instance of the RadTreeNode class.

C#
public RadTreeNode(string text, bool expanded)
Parameters:textstring

The text to be used as label text.

expandedbool

A boolean value indicating whether the node is expanded.

C#
public RadTreeNode(string text, Image image, bool expanded)
Parameters:textstringimageImageexpandedbool
C#
public RadTreeNode(string text, Image image)
Parameters:textstringimageImage
C#
public RadTreeNode(string text, RadTreeNode[] children)
Parameters:textstringchildrenRadTreeNode[]
C#
public RadTreeNode(string text)
Parameters:textstring

Fields

C#
protected int cachedIndex
C#
protected const int IsAllowDropState = 64
C#
protected const int IsCurrentState = 8
C#
protected const int IsEnableState = 32
C#
protected const int IsExpandedState = 2
C#
protected const int IsSelectedState = 4
C#
protected const int IsVisibleState = 16
C#
protected BitVector32 state
C#
protected const int SuspendNotificationsState = 1
C#
protected const int UpdateParentSizeOnExpandedChangedState = 128

Properties

Gets or sets the measured desired width for this node.

C#
[Browsable(false)]
public Size ActualSize { get; }

Gets or sets a value indicating whether [allow drop].

C#
[Browsable(false)]
public bool AllowDrop { get; set; }
Property Value:

true if [allow drop]; otherwise, false.

Gets or sets the backcolor of the tree node. Color type represents an ARGB color.

C#
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.

C#
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.

C#
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.

C#
public Color BackColor4 { get; set; }

Gets or sets the border color of the tree node.

C#
public Color BorderColor { get; set; }

Gets or sets a value indicating whether this RadTreeNode is checked.

C#
public bool Checked { get; set; }
Property Value:

true if checked; otherwise, false.

Gets or sets the state of the check element.

C#
public virtual ToggleState CheckState { get; set; }
Property Value:

The state of the check.

Gets or sets the type of the check element.

C#
public CheckType CheckType { get; set; }
Property Value:

The type of the check.

Gets or sets the measured desired width for this node.

C#
[Browsable(false)]
public Size ChildrenSize { get; }

Gets or sets the context menu associated to the node.

C#
public virtual RadContextMenu ContextMenu { get; set; }
Property Value:

Returns an instance of RadDropDownMenu that is associated with the node. The default value is null.

Remarks:

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.

C#
[Browsable(false)]
public bool Current { get; set; }
Property Value:

true if this instance is current; otherwise, false.

Gets the data-bound object that populated the node.

C#
[Browsable(false)]
public object DataBoundItem { get; }

Gets or sets a value indicating whether the node can respond to user interaction.

C#
public bool Enabled { get; set; }
Property Value:

The default value is true.

Gets or sets a value indicating whether this instance is expanded.

C#
[Browsable(false)]
public bool Expanded { get; set; }
Property Value:

true if this instance is expanded; otherwise, false.

Gets the first node.

C#
[Browsable(false)]
public RadTreeNode FirstNode { get; }
Property Value:

The first node.

Gets or sets the font of the node text.

C#
public Font Font { get; set; }
Property Value:

The default value is null.

Gets or sets the foreground color of the tree node. This color is applied to the text label.

C#
public virtual Color ForeColor { get; set; }

Gets the full path.

C#
[Browsable(false)]
public string FullPath { get; }
Property Value:

The full path.

Gets or sets gradient angle for linear gradient.

C#
public float GradientAngle { get; set; }
Property Value:

The default value is 90.0.

Gets or sets GradientPercentage for linear, glass, office glass, gel, vista, and radial gradients.

C#
public float GradientPercentage { get; set; }
Property Value:

The default value is 0.5.

Gets or sets GradientPercentage for office glass, vista, and radial gradients.

C#
public float GradientPercentage2 { get; set; }
Property Value:

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.

C#
public GradientStyles GradientStyle { get; set; }
Property Value:

The default value is GradientStyles.

Gets a value indicating whether this instance has style.

C#
[Browsable(false)]
public bool HasStyle { get; }
Property Value:

true if this instance has style; otherwise, false.

Gets or sets the image of the node.

C#
[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.

C#
[RelatedImageList("TreeView.ImageList")]
[TypeConverter("Telerik.WinControls.UI.Design.NoneExcludedImageIndexConverter, Telerik.WinControls.UI.Design, Version=2026.2.702.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.

C#
[RelatedImageList("TreeView.ImageList")]
[TypeConverter("Telerik.WinControls.UI.Design.RadImageKeyConverter, Telerik.WinControls.UI.Design, Version=2026.2.702.48, Culture=neutral, PublicKeyToken=5bb2a467cbec794e")]
public string ImageKey { get; set; }

Gets the index.

C#
[Browsable(false)]
public virtual int Index { get; }
Property Value:

The index.

Gets a value indicating whether this instance is editing.

C#
[Browsable(false)]
public bool IsEditing { get; }
Property Value:

true if this instance is editing; otherwise, false.

Gets or a value indicating whether the control is in design mode.

C#
[Browsable(false)]
public bool IsInDesignMode { get; }

Gets or sets the height of the tree node in the tree view control.

C#
[Browsable(true)]
public int ItemHeight { get; set; }
Property Value:

The default value is 20.

Gets the last node.

C#
[Browsable(false)]
public RadTreeNode LastNode { get; }
Property Value:

The last node.

Gets the level.

C#
[Browsable(false)]
public int Level { get; }
Property Value:

The level.

Matches

IEnumerator<RadTreeNode>

Gets the last matches using Find method.

C#
[Browsable(false)]
public IEnumerator<RadTreeNode> Matches { get; }
Property Value:

Gets the last matches using Find method.

Gets or sets the name of the RadTreeNode.

C#
[Browsable(true)]
public string Name { get; set; }
Property Value:

A String that represents the name of the tree node.

Remarks:

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.

C#
[Browsable(false)]
public RadTreeNode NextNode { get; }
Property Value:

The next node.

Gets the next visible node.

C#
[Browsable(false)]
public RadTreeNode NextVisibleNode { get; }
Property Value:

The next visible node.

Gets the nodes.

C#
[ListBindable(false)]
[Browsable(true)]
public RadTreeNodeCollection Nodes { get; }
Property Value:

The nodes.

Gets or sets the number of used colors in the gradient effect.

C#
public int NumberOfColors { get; set; }
Property Value:

The default value is 4.

Gets or sets the parent.

C#
[Browsable(false)]
public RadTreeNode Parent { get; }
Property Value:

The parent.

Gets the prev node.

C#
[Browsable(false)]
public RadTreeNode PrevNode { get; }
Property Value:

The prev node.

Gets the prev visible node.

C#
[Browsable(false)]
public RadTreeNode PrevVisibleNode { get; }
Property Value:

The prev visible node.

Gets the root parent node for this RadTreeView.

C#
[Browsable(false)]
public RadTreeNode RootNode { get; }
Property Value:

The default value is null.

Gets or sets a value indicating whether this instance is selected.

C#
[Browsable(false)]
public bool Selected { get; set; }
Property Value:

true if this instance is selected; otherwise, false.

Gets the style.

C#
[Browsable(false)]
public TreeNodeStyle Style { get; }
Property Value:

The style.

Gets or sets the vector image of the node.

C#
[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.

C#
[Bindable(true)]
[TypeConverter(typeof(StringConverter))]
public object Tag { get; set; }
Property Value:

The tag.

Gets or sets the text.

C#
public string Text { get; set; }
Property Value:

The text.

Gets or sets the text alignment.

C#
public ContentAlignment TextAlignment { get; set; }
Property Value:

The default value is ContentAlignment.MiddleLeft.

Gets or sets the text that appears when the mouse pointer hovers over a tree node.

C#
public string ToolTipText { get; set; }
Property Value:

The default value is "".

Gets the parent tree view that the tree node is assigned to.

C#
[Browsable(false)]
public RadTreeView TreeView { get; }

Gets or sets the tree view element.

C#
[Browsable(false)]
public RadTreeViewElement TreeViewElement { get; }
Property Value:

The tree view element.

Gets or sets the node value.

C#
public virtual object Value { get; set; }
Property Value:

The text.

Gets or sets a value indicating whether this instance is visible.

C#
public virtual bool Visible { get; set; }
Property Value:

true if this instance is visible; otherwise, false.

Methods

Initiates the editing of the tree node.

C#
public bool BeginEdit()
Returns:

bool

C#
protected void CacheLastFind(List<RadTreeNode> nodes)
Parameters:nodesList<RadTreeNode>

Cancels the edit.

C#
public bool CancelEdit()
Returns:

bool

Creates a new object that is a copy of the current instance.

C#
public object Clone()
Returns:

object

A new object that is a copy of this instance.

Implements: ICloneable.Clone()

Collapses the tree node.

C#
public void Collapse()

Collapses the RadTreeNode and optionally collapses its children.

C#
public void Collapse(bool ignoreChildren)
Parameters:ignoreChildrenbool

if set to true [ignore children].

Ends the edit.

C#
public bool EndEdit()
Returns:

bool

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

C#
public void EnsureVisible()

Executes the specified command include sub trees.

C#
public object Execute(bool includeSubTrees, ICommand command, params object[] settings)
Parameters:includeSubTreesbool

if set to true [include sub trees].

commandICommand

The command.

settingsobject[]

The settings.

Returns:

object

Executes the specified command.

C#
public object Execute(ICommand command, params object[] settings)
Parameters:commandICommand

The command.

settingsobject[]

The settings.

Returns:

object

Expands the tree node.

C#
public void Expand()

Expands all the child tree nodes.

C#
public void ExpandAll()

Finds the specified match.

C#
public RadTreeNode Find(Predicate<RadTreeNode> match)
Parameters:matchPredicate<RadTreeNode>

The match.

Returns:

RadTreeNode

C#
public RadTreeNode Find<T>(FindAction<T> match, T arg)
Parameters:matchFindAction<T>argTReturns:

RadTreeNode

Finds the nodes.

C#
public RadTreeNode[] FindNodes(Predicate<RadTreeNode> match)
Parameters:matchPredicate<RadTreeNode>

The match.

Returns:

RadTreeNode[]

Finds the nodes.

C#
public RadTreeNode[] FindNodes<T>(FindAction<T> match, T arg)
Parameters:matchFindAction<T>

The match.

argT

The argument.

Returns:

RadTreeNode[]

Execute the action for every RadTreeNode in the branch

C#
public void ForEach(Action<RadTreeNode> action)
Parameters:actionAction<RadTreeNode>
C#
protected virtual void GetFullPath(StringBuilder path, string pathSeparator)
Parameters:pathStringBuilderpathSeparatorstring

Returns the number of child tree nodes.

C#
public int GetNodeCount(bool includeSubTrees)
Parameters:includeSubTreesbool

if set to true [include sub trees].

Returns:

int

C#
public void InvalidateOnState()
C#
public void InvalidateOnState(bool recursive)
Parameters:recursivebool
C#
protected virtual void NotifyExpandedChanged(RadTreeNode node)
Parameters:nodeRadTreeNode
C#
protected virtual void OnCheckStateChanged()
C#
protected virtual void OnCheckStateChanged(CheckedMode checkedMode)
Parameters:checkedModeCheckedMode
C#
protected virtual void OnDataBoundItemChanged(object oldItem, object newItem)
Parameters:oldItemobjectnewItemobject
C#
protected virtual void OnNotifyPropertyChanged(PropertyChangedEventArgs args)
Parameters:argsPropertyChangedEventArgs
C#
protected virtual void OnNotifyPropertyChanged(string name)
Parameters:namestring

Removes the current tree node from the tree view control.

C#
public virtual void Remove()

Resumes property notifications after a previous SuspendPropertyNotifications() call.

C#
public void ResumePropertyNotifications()
C#
protected virtual bool SetBooleanProperty(string propertyName, int propertyKey, bool value)
Parameters:propertyNamestringpropertyKeyintvalueboolReturns:

bool

Sets the IBindingList which holds the child nodes in Object Relational Binding mode

C#
protected virtual void SetBoundChildNodesList(IBindingList bindingList)
Parameters:bindingListIBindingList
C#
protected virtual bool SetCheckStateCore(ToggleState value)
Parameters:valueToggleStateReturns:

bool

Allows PropertyChanged notifications to be temporary suspended.

C#
public void SuspendPropertyNotifications()

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

C#
public void Toggle()

Returns a string that represents the tree node.

C#
public override string ToString()
Returns:

string

A string that represents the tree node.

Overrides: object.ToString()

C#
protected virtual void UpdateChildrenCheckState()
C#
protected virtual void UpdateParentCheckState()

Events

C#
public event PropertyChangedEventHandler PropertyChanged

Implements: INotifyPropertyChanged.PropertyChanged

In this article
DefinitionConstructorsRadTreeNode()RadTreeNode(string, bool)RadTreeNode(string, Image, bool)RadTreeNode(string, Image)RadTreeNode(string, RadTreeNode[])RadTreeNode(string)FieldscachedIndexIsAllowDropStateIsCurrentStateIsEnableStateIsExpandedStateIsSelectedStateIsVisibleStatestateSuspendNotificationsStateUpdateParentSizeOnExpandedChangedStatePropertiesActualSizeAllowDropBackColorBackColor2BackColor3BackColor4BorderColorCheckedCheckStateCheckTypeChildrenSizeContextMenuCurrentDataBoundItemEnabledExpandedFirstNodeFontForeColorFullPathGradientAngleGradientPercentageGradientPercentage2GradientStyleHasStyleImageImageIndexImageKeyIndexIsEditingIsInDesignModeItemHeightLastNodeLevelMatchesNameNextNodeNextVisibleNodeNodesNumberOfColorsParentPrevNodePrevVisibleNodeRootNodeSelectedStyleSvgImageTagTextTextAlignmentToolTipTextTreeViewTreeViewElementValueVisibleMethodsBeginEdit()CacheLastFind(List<RadTreeNode>)CancelEdit()Clone()Collapse()Collapse(bool)EndEdit()EnsureVisible()Execute(bool, ICommand, params object[])Execute(ICommand, params object[])Expand()ExpandAll()Find(Predicate<RadTreeNode>)Find<T>(FindAction<T>, T)FindNodes(Predicate<RadTreeNode>)FindNodes<T>(FindAction<T>, T)ForEach(Action<RadTreeNode>)GetFullPath(StringBuilder, string)GetNodeCount(bool)InvalidateOnState()InvalidateOnState(bool)NotifyExpandedChanged(RadTreeNode)OnCheckStateChanged()OnCheckStateChanged(CheckedMode)OnDataBoundItemChanged(object, object)OnNotifyPropertyChanged(PropertyChangedEventArgs)OnNotifyPropertyChanged(string)Remove()ResumePropertyNotifications()SetBooleanProperty(string, int, bool)SetBoundChildNodesList(IBindingList)SetCheckStateCore(ToggleState)SuspendPropertyNotifications()Toggle()ToString()UpdateChildrenCheckState()UpdateParentCheckState()EventsPropertyChanged
Not finding the help you need?
Contact Support