TreeListNode.Expanded Property
Gets or sets whether the node is expanded.
Namespace: DevExpress.XtraTreeList.Nodes
Assembly: DevExpress.XtraTreeList.v24.2.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
Boolean | false | true if the node is expanded; otherwise, false. |
Remarks
Use the methods below to expand and collapse tree list nodes.
- TreeList.ExpandAll—expands all nodes.
TreeList.CollapseAll—collapses all nodes.
TreeList.ExpandToLevel(System.Int32)—expands nodes up to the specified level. The zeroth level corresponds to root nodes. To obtain a node’s level, use the TreeListNode.Level property.
TreeList.CollapseToLevel(System.Int32)—collapses all nodes at the specified and subsequent levels.
TreeListNode.ExpandAll—expands the node’s child nodes.
TreeListNode.CollapseAll—collapses the node’s child nodes.
TreeListNode.Expand—expands this node. Use the TreeListNode.HasChildren property to check if a node has child nodes that can be expanded or collapsed.
You can also use the
TreeListNode.Expanded
property to obtain or set whether a node is expanded or collapsed.- TreeListNode.Collapse—collapses this node.
The control’s BeforeExpand, AfterExpand, BeforeCollapse, and AfterCollapse events fire during expand and collapse operations. For example, you can handle the BeforeExpand event to dynamically create child nodes in unbound mode.
Example
The code below changes the first visible node’s expand state.
using DevExpress.XtraTreeList.Nodes;
TreeListNode node = treeList1.GetNodeByVisibleIndex(0);
node.Expanded = !node.Expanded;
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Expanded property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.