WPF TreeView Recursive Traversal related methods

Source: Internet
Author: User

1         /// <summary>2         ///recursively changes the organization tree selected state. 3         /// </summary>4         /// <param name= "org" ></param>5         Private voidrecursionorgdatatreestatus (orgdata org)6         {7             foreach(varIteminchorg. Nodes)8             {9Item. IsChecked =org. IsChecked;Ten                 if(item. Nodes.count >0) One                 { A recursionorgdatatreestatus (item); -                 } -             } the         } -  -  -          ///Gets the selected organization data.  +         /// </summary> -         Private voidGetcheckedorgdata () +         { A             foreach(Orgdata Orgdatainchorgdatacollection) at             { -                 if(orgdata.ischecked) Receiverdata.add (orgdata); -                 if(Orgdata.haschild) -                 { - Getcheckedorgchilddata (orgdata); -                 } in             } -         } to         /// <summary> +         ///gets the data selected by the child node of the selected organization.  -         /// </summary> the         Private voidgetcheckedorgchilddata (orgdata org) *         { $             foreach(Orgdata Orgdatainchorg. Nodes)Panax Notoginseng             { -                 if(orgdata.ischecked) Receiverdata.add (orgdata); the                 if(Orgdata.haschild) getcheckedorgchilddata (orgdata); +             } A         } the  +  -         /// <summary> $         ///recursively takes the node selected under the parent node.  $         /// </summary> -         /// <param name= "org" ></param> -         Private voidgetcheckedorgdatabyorgparent (orgdata org) the         { -             if(org = =NULL)return;Wuyi             if(org. Parent = =NULL&&org. IsChecked) receiverdata.add (org); the             if(org. Parent! =NULL) -             { Wu                 foreach(varNodeinchorg. Parent.nodes) -                 { About                     if(node. IsChecked) receiverdata.add (node); $                 } -             } - getcheckedorgdatabyorgparent (org. Parent); -         } A  +  the  -          /// <summary> $         ///recursively deletes a node's parent node.  the         /// </summary> the         /// <param name= "org" ></param> the         Private voiddeletedorgdata (orgdata org) the         { -             if(org = =NULL)return; in             if(org. Parent = =NULL)return; the receiverdata.remove (org. Parent); the deletedorgdata (org. Parent); About}
View Code

WPF TreeView Recursive Traversal related methods

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.