Back to Devexpress

TreeListNode.Checked Property

windowsforms-devexpress-dot-xtratreelist-dot-nodes-dot-treelistnode-8a0b57d3.md

latest4.2 KB
Original Source

TreeListNode.Checked Property

Gets or sets whether the node is checked.

Namespace : DevExpress.XtraTreeList.Nodes

Assembly : DevExpress.XtraTreeList.v25.2.dll

NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.TreeList

Declaration

csharp
[Browsable(false)]
[DXCategory("Behavior")]
public virtual bool Checked { get; set; }
vb
<Browsable(False)>
<DXCategory("Behavior")>
Public Overridable Property Checked As Boolean

Property Value

TypeDescription
Boolean

true if the node is checked; otherwise, false.

|

Remarks

Use the Checked property to get/set a node’s check state when nodes can only have two check states (checked and unchecked).

If the TreeListOptionsBehavior.AllowIndeterminateCheckState property is true , a node can have three check states: checked, unchecked and indeterminate. In this instance, to get/set a node’s check state, use the TreeListNode.CheckState property.

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.

csharp
List<TreeListNode> list = treeList1.GetAllCheckedNodes();
foreach (TreeListNode node in list) {
    decimal budget = Convert.ToDecimal(node["BUDGET"])*1.1m;
    node["BUDGET"] = budget;
}
vb
Dim list As List(Of TreeListNode) = treeList1.GetAllCheckedNodes()
For Each node As TreeListNode In list
    Dim budget As Decimal = Convert.ToDecimal(node("BUDGET")) * 1.1D
    node("BUDGET") = budget
Next

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Checked 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.

winforms-treelist-custom-check-nodes-behavior/CS/Example/TreeListCheckHelper.cs#L29

csharp
TreeListNode node = e.Node;
if(node.Checked)
    node.UncheckAll();

winforms-treelist-custom-check-nodes-behavior/VB/Example/TreeListCheckHelper.vb#L27

vb
Dim node As TreeListNode = e.Node
If node.Checked Then
    node.UncheckAll()

See Also

CheckState

Node Checking - Checkboxes and Radio Buttons

TreeListNode Class

TreeListNode Members

DevExpress.XtraTreeList.Nodes Namespace