TreeList.GetAllCheckedNodes() Method

Returns the list of checked nodes.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v20.1.dll

Declaration

public List<TreeListNode> GetAllCheckedNodes()
Public Function GetAllCheckedNodes As List(Of TreeListNode)

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.

Examples

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