Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to obtain checked nodes

$
0
0

Starting with the 12.1.2 version, you can use the TreeListOptionsBehavior.AllowRecursiveNodeChecking option instead of this sample approach.

You can use this example in versions older than 12.1.2.
This example demonstrates how to obtain checked nodes from the TreeList. To accomplish this task, you need to create your own TreeListOperation descendant and override its Execute method. Then, call the TreeList.NodesIterator.DoOperation method, and pass the new instance of your TreeListOperation descendant as a parameter. The TreeListNodesIterator iterates through all nodes and calls the Execute method for each node. So, you need simply check the CheckState property of this node and perform necessary operations. For example, you can implement an integer property CheckedNodesCount in your TreeListOperation descendant and increment its value from the Execute method if the CheckState property of the current node is CheckState.Checked. After you call the DoOperation method, this property will return the number of checked nodes.

Also, you can override the CanContinueIteration and NeedsVisitChildren methods to perform more complex operations. For example, iterate only through child nodes of a particular parent.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>