I have a treeview with 3 levels. On select event for a parent node I would like the control to auto-check all child nodes. I see this happening only when the node is expanded. If the node is collapsed, it only checks the parent node only. Is this a bug?
3 Answers, 1 is accepted
0
Petar Mladenov
Telerik team
answered on 07 Nov 2011, 05:12 PM
Hi Spj11,
Do you actually mean Checked event instead of Select (SelectionChanged)? I guess you mean that you use the IsInTriStateMode set to true on the RadTreeView. So what happens when you check a parent node and then expand it ?
By design, the RadTreeViewItems are generated initially when they are root level items and all other RadTreeViewItems are generated when their parent is being expanded. So when you expand a node, then its children are generated but their CheckState property does not inherit their parent's CheckState automatically. The "TriState" logic basically works only with already created containers(RadTreeViewItems). The way to workaround this is to use DataBinding with ViewModels and create your own custom Tri-State logic in these viewmodels. You can examine how this could be achieved in this code library project.
Regards,
Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I looked at your code library project and it seems to work fine as is. When I changed the SL version to 5 and upgraded to the latest telerik controls (2012.2.607.1050), the code doesn't work anymore. Eg: unselecting a leaf level node, deselects the parent nodes among other issues, can you please look at it and let me know if this is is a bug in your control or bug in the code library.
Thanks
0
Tina Stancheva
Telerik team
answered on 16 Jul 2012, 04:07 PM
Hello,
You're right and this is our mistake. Actually we've created an updated version of this code library which can now be found under the TreeView category in our CodeLibrary and we also have a step-by-step tutorial on the subject in our documentation.
The updated solution should work as expected with the latest release of the controls, but please let us know if you encounter any issues.