Skip to main content
A newer version of this page is available. .

TreeList.GetAllCheckedNodes() Method

Returns the list of checked nodes.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v19.2.dll

Declaration

public List<TreeListNode> GetAllCheckedNodes()

Returns

Type Description
List<TreeListNode>

The list of checked nodes.

Remarks

A node is checked if its TreeListNode.Checked property is true. The list returned by the GetAllCheckedNodes method does not include nodes with the indeterminate check state.

Example

The following code shows how to retrieve checked nodes using the TreeList.GetAllCheckedNodes method, and modify their values.

List<TreeListNode> list = treeList1.GetAllCheckedNodes();
foreach (TreeListNode node in list) {
    decimal budget = Convert.ToDecimal(node["BUDGET"])*1.1m;
    node["BUDGET"] = budget;
}

Example

The following example shows how to use a node iterator to retrieve unchecked TreeList nodes.

using DevExpress.XtraTreeList.Nodes.Operations;

GetUncheckedNodesOperation op = new GetUncheckedNodesOperation();
treeList1.NodesIterator.DoOperation(op);
//Get the number of unchecked nodes:
int count = op.TargetNodes.Count;

//The operation class that collects unchecked nodes
class GetUncheckedNodesOperation : TreeListOperation {
    public List<TreeListNode> TargetNodes = new List<TreeListNode>();
    public GetUncheckedNodesOperation() : base() { }
    public override void Execute(TreeListNode node) {
        if (node.CheckState == CheckState.Unchecked)
            TargetNodes.Add(node);
    }
}

See Node Checking - Checkboxes and Radio Buttons to learn more.

Example

The following code shows how to retrieve checked nodes using the TreeList.GetAllCheckedNodes method, and modify their values.

List<TreeListNode> list = treeList1.GetAllCheckedNodes();
foreach (TreeListNode node in list) {
    decimal budget = Convert.ToDecimal(node["BUDGET"])*1.1m;
    node["BUDGET"] = budget;
}
See Also