This is a migrated thread and some comments may be shown as answers.

Check event doesn't select child items

3 Answers 89 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
spj11
Top achievements
Rank 1
spj11 asked on 03 Nov 2011, 03:20 AM
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

Sort by
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 >>

0
spj11
Top achievements
Rank 1
answered on 12 Jul 2012, 09:52 PM
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.

Regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TreeView
Asked by
spj11
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
spj11
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or